blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
4
137
path
stringlengths
2
355
src_encoding
stringclasses
31 values
length_bytes
int64
11
3.9M
score
float64
2.52
5.47
int_score
int64
3
5
detected_licenses
listlengths
0
49
license_type
stringclasses
2 values
text
stringlengths
11
3.93M
download_success
bool
1 class
37c881da6120a1797ff78db6ed60267b37605634
Ruby
ken1882/MLPRPG_VODL
/Old Data Scripts/172_MOG_Weather_EX.rb
UTF-8
28,923
2.625
3
[]
no_license
#============================================================================== # +++ MOG - Weather EX (v1.6) +++ #============================================================================== # By Moghunter # http://www.atelier-rgss.com/ #====================================================================...
true
6d297ff7c77de977cf4f1df842b69c243d529b4d
Ruby
Schwoisser/space-ship
/components/weopon.rb
UTF-8
512
2.765625
3
[]
no_license
class Weopon < Component def initialize(name,energyConsumption,damageMin,damageDice,precision) super(name,energyConsumption) @damageMin,@damageDice,@precision = damageMin,damageDice,precision @loaded = true end def fire if @loaded @loaded = false return (rand(@damageDice)+@damageMin...
true
2ec208faabecf6d5d90c49b39276d6139c98ada9
Ruby
vickymg/till_program
/spec/menu_spec.rb
UTF-8
446
2.578125
3
[]
no_license
require 'menu' describe Menu do test_cafe = File.read('./spec/testCafe.json') parsed_cafe = JSON.parse(test_cafe) subject(:menu) { described_class.new(cafe = test_cafe) } it 'should parse a json file containing coffee shop details and items' do expect(menu.cafe).to eq(parsed_cafe) end describe '#pri...
true
01212c964627686b5614319d75516be8f8d63b48
Ruby
mobmewireless/url-agent
/lib/url_agent/base.rb
UTF-8
3,242
2.5625
3
[]
no_license
require 'singleton' require 'logger' require 'yaml' require 'uri' require 'active_support/core_ext/hash' require_relative 'dispatcher' class URLAgent::Base include Singleton attr_reader :logger, :pinger attr_accessor :urls def initialize(options = {}) @configured = false @options = options end ...
true
c673dd56bc87cf918c32aebc07c370f96d277525
Ruby
rubyforgood/casa
/db/seeds.rb
UTF-8
4,031
2.765625
3
[ "MIT" ]
permissive
# This seed script populates the development DB with a data set whose size is dependent on the Rails environment. # You can control the randomness of the data provided by FAKER and the Rails libraries via the DB_SEEDS_RANDOM_SEED environment variable. # If you specify a number, that number will be used as the seed, so...
true
c6e7dd3e4307ab039b1c889be28d1a97ded321d6
Ruby
deniseyu/battleships-again
/spec/grid_spec.rb
UTF-8
515
2.578125
3
[]
no_license
require './app/models/grid' describe Grid do let(:grid) { Grid.new } before(:each) do grid.populateGrid end it 'should be composed of a giant hash' do expect(grid.coordinates.class).to eq Hash end it 'should have 100 cells' do expect(grid.coordinates.length).to eq 100 end it 'should ha...
true
d592e9d96c0df274c48b7515f69169e97225c28c
Ruby
claireduf/mood
/actions/mood.rb
UTF-8
4,358
2.515625
3
[ "MIT" ]
permissive
module Clarke module ActionController action 'ask_for_mood' do buttons = [ { label: '0: Miserable, nervous', action: 'MOOD_0'}, { label: '1: Sad, unhappy', action: 'MOOD_1'}, { label: '2: down, worried', action: 'MOOD_2'}, { label: '3: good, alright', action: 'MOOD_3'}, ...
true
ba7660aee60dcc3463ef919867ae3fc078e3f266
Ruby
iainjmitchell/codejo-site
/deployment/deployer.rb
UTF-8
2,048
3.03125
3
[]
no_license
require 'net/ftp' require 'yaml' class FTPClient attr_reader :remote_path def initialize(remote_path) @remote_path = remote_path end def ftp @ftp ||= Net::FTP.new end def connect ftp_credentials = YAML.load_file("credentials.yaml") ftp.connect(ftp_credentials["server"]) ftp.login(...
true
210191e8efcba4623dce67c44c670006dcf15904
Ruby
michaeledgar/byte_parsers
/spec/spec_helper.rb
UTF-8
2,172
2.578125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'byte_parsers' require 'spec' require 'spec/autorun' require 'rubygems' require 'faker' Spec::Runner.configure do |config| end module ByteParsers module RSpec module Macros def is_fi...
true
42c406a9dd92f0af9cad0a5c630bbba05861c9db
Ruby
ancorcruz/ruby-katas
/supermarket-offers/checkout.rb
UTF-8
2,425
3.265625
3
[]
no_license
#----------------------------------# # Ancor Cruz <hello@ancorcruz.com> # #----------------------------------# #require 'rubygems' #require 'debugger' class Product attr_accessor :code, :name, :price def initialize(code, name, price) @code, @name, @price = code, name, price end end class Offer attr_acce...
true
918c8949d20162a2129b2b659cf1bcdf4d367d6d
Ruby
jarmstro0/Week2
/beer.rb
UTF-8
250
3.75
4
[]
no_license
beers = 99 def sing count puts "#{count} bottles of beer on the wall" puts "#{count} bottles of beer" puts "You take one down, pass it around" count -=1 puts "#{count} bottles of beer on the wall" end while beers > 0 sing beers beers -=1 end
true
ca138f80c6bfa5ed80fe3e493bf2f3ac6e612e1c
Ruby
KevinMcHugh/mustached-nemesis
/app/models/events/game_over_event.rb
UTF-8
1,061
3
3
[]
no_license
class GameOverEvent < Event attr_reader :game def initialize(event_listener, game) @game = game super(event_listener) end def winners return @winners if @winners living_players = game.living_players if living_players.find { |p| p.sheriff?} @winners = game.players.find_all { |player| [...
true
4745a14f4505792a6fa294681b08275d58cbcdfe
Ruby
jemmyw/bisques
/lib/bisques/queue_listener.rb
UTF-8
2,578
3.578125
4
[ "MIT" ]
permissive
require 'bisques/queue' require 'thread' module Bisques # Listen for messages on a queue and execute a block when they arrive. class QueueListener # @param [Queue] queue the queue to listen on # @param [Fixnum] poll_time the number of seconds to long poll during each iteration. Maximum is 20. def initi...
true
ffb429d03484d6bc6185d5b8a2edd2369e69d696
Ruby
edwinlin/badges-and-schedules-dumbo-web-career-010719
/conference_badges.rb
UTF-8
566
3.921875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code here. def badge_maker(name) return "Hello, my name is #{name}." end def batch_badge_creator(names) new_array = [] names.each do |name| new_array << "Hello, my name is #{name}." end return new_array end def assign_rooms(speakers) new_array = [] speakers.each_with_index do |speaker,...
true
4c52c962b6f308a2ac5258717471d3712adae42d
Ruby
SpencerArtisan/movierobot
/lib/showing_batch.rb
UTF-8
187
2.59375
3
[]
no_license
class ShowingBatch def initialize showings, end_date @showings = showings @end_date = end_date end def showings @showings end def end_date @end_date end end
true
57488073a9a5f9056f0a0f4cefe82b1bc01b8d1a
Ruby
jaosn/leedcode_ruby
/decode_ways.rb
UTF-8
780
3.953125
4
[]
no_license
require "pry-byebug" # A message containing letters from A-Z is being encoded to numbers using the following mapping: # # 'A' -> 1 # 'B' -> 2 # ... # 'Z' -> 26 # Given an encoded message containing digits, determine the total number of ways to decode it. # # For example, # Given encoded message "12", it could be deco...
true
b6e0a2e0482cc361e6917ca1d002ea4bed15d9bf
Ruby
mori15haru/gosu-cube
/transformation/matrix.rb
UTF-8
377
3.265625
3
[]
no_license
module Transformation class Matrix attr_reader :matrix private :matrix def initialize(matrix) @matrix = matrix end def self.identity new( [ [1, 0, 0], [0, 1, 0], [0, 0, 1] ] ) end def *(vector) matrix.map { |u| u.zip(...
true
ad9cd780e9aa5b83e1eae483bf191d07c009bcef
Ruby
klrosenberg/06-23-sinatra-beer
/controllers/beers.rb
UTF-8
2,415
2.515625
3
[]
no_license
# ----------------------------------------------------------------------------- # Add beer to table # ----------------------------------------------------------------------------- get "/save_beer" do if Beer.include(params['name']) @error1 = true erb :"/beers/add_beer" elsif Beer.empty(params['name']) ...
true
d07cbe5d9a509c88270dadf37dcb71ffb147e6c2
Ruby
ryohashimoto/lightrails
/activerepresenter/test/attr_one_test.rb
UTF-8
1,191
2.5625
3
[ "MIT" ]
permissive
require "test/unit" require "ostruct" require "active_support/time" require_relative "../lib/active_representer/base.rb" class ProfileRepresenter < ActiveRepresenter::Base def email_sent_on email_sent_at.to_date end end class UserRepresenter < ActiveRepresenter::Base attr_one :profile end class AttrOneTest...
true
9e119be13b81f8124e6af48631799b6c00c1488f
Ruby
nyomo/slack_goodies
/lib/slack_goodies/connection.rb
UTF-8
1,974
2.640625
3
[ "MIT" ]
permissive
require 'slack-ruby-client' module SlackGoodies class Connection def initialize Slack.configure do |config| config.token = ENV['SLACK_API_USER_TOKEN'] end @slack = Slack::Web::Client.new chk = self.auth_test if chk["ok"] == false raise ApiKeyPermissionError.exception(...
true
4dd1e4be78903f3a40b8c636cc66bfcfc260e914
Ruby
flegelleicht/latexam
/bin/check-exam.rb
UTF-8
1,922
3.03125
3
[ "MIT" ]
permissive
# LINK https://www.pdflabs.com/docs/pdftk-man-page/#dest-op-dump-data-fields-utf8 # LINK https://github.com/andrewgarner/docker-pdftk # LINK https://tex.stackexchange.com/questions/136599/checkbox-from-hyperref-tick-by-default # LINK https://www.tug.org/applications/hyperref/manual.html#x1-220006.2 def extractFields(fi...
true
74f230ba841487bd43fe649a1bc094c79f65dc2b
Ruby
solebox/Programming
/ruby/misc/recursiveSelectionSort.rb
UTF-8
194
3.0625
3
[]
no_license
def sort(a,i) if i == a.length return; else min = 0 for j in i..a.length-1 do if a[j] < a[min] min = j end temp = a[i] a[i] = a[min] a[min] = temp sort(a,i+1) end end
true
54c0411badd013f9cb9b6ffade66f211d4fea1d8
Ruby
sandman8654/OpenStudent
/app/reports/mixpanel_report.rb
UTF-8
6,679
3
3
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
require 'date' require 'json' # Querys the MixPanel API for aggregate, non-personally identifiable usage data. # Intended to be run weekly. class MixpanelReport def initialize(mixpanel_api_secret) @mixpanel_api_secret = mixpanel_api_secret @today = Date.today @reporting_period_in_days = 14 @buffer = ...
true
5d35484609cc6603c59e5b6377345309e34c3937
Ruby
marv070/greene_co_kaza
/greene_county_kata_arrays.rb
UTF-8
603
3.75
4
[]
no_license
list = 1 numbers = [] while list <= 100 if list % 3 == 0 && list % 5 == 0 numbers.push( "greene_county" ) elsif list % 3 == 0 #replace all numbers divisable by 3 with greene numbers.push( "greene" ) # replace all numbers divisable by 5 w/ county elsif list % 5 == 0 # re...
true
9a8ae94c96f8453ef6baba2e5ad831938520b38a
Ruby
rolandobrown/prework-sql-challenge-web-0715-public
/spec/sql_challenge_spec.rb
UTF-8
1,289
3.296875
3
[]
no_license
describe "SQL Challenge" do it 'creates a table called cats' do your_answer = 'CREATE TABLE cats;' expect(your_answer).to eq(answer_1) end it 'returns all of the data in the cats table' do your_answer = 'SELECT * FROM cats;' expect(your_answer).to eq(answer_2) end it 'returns the count of r...
true
01858982093bcccd045d49ef297837d461b05d8b
Ruby
0xack13/panoptimon
/collectors/smtp/lib/panoptimon-collector-smtp/smtp.rb
UTF-8
605
2.5625
3
[ "BSD-3-Clause" ]
permissive
require "socket" require "timeout" module Panoptimon module Collector class SMTP attr_reader :host, :port, :timeout def initialize(args={}) args.each { |k,v| instance_variable_set("@#{k}", v) } end def collect c = begin Timeout::timeout(timeout) { c...
true
39d7f538581df7fa40d097db4a1dcd64360bae19
Ruby
jamespjbennett/ruby-football-league-generator
/lib/score_formatter.rb
UTF-8
700
3.125
3
[]
no_license
class ScoreFormatter def initialize(home_team, away_team) @home_team = home_team @away_team = away_team end end class ScoreString < ScoreFormatter def call(home_team_goals, away_team_goals) p team_goal_string(home_team_goals,@home_team) + " - " + team_goal_string(away_team_goals,@away_team) end ...
true
44e3d3931d9567a4cd84aa585e9ab88f863a9dc5
Ruby
codeprimate/rubyservermonitor
/ServerMonitor.rb
UTF-8
11,415
2.671875
3
[]
no_license
module ServerMonitor require 'date' require 'net/http' require 'net/https' require 'net/smtp' require 'open-uri' require 'rexml/document' require 'fileutils' include REXML Port = Struct.new("Port",:number,:tested,:success, :time) Url = Struct.new("Url",:url, :tested, :success, :time) MonitorReport = Struc...
true
a9c35a7faee584a613448f8cd59043015dc283c4
Ruby
akiu/rubyBasic
/class.rb
UTF-8
100
2.6875
3
[]
no_license
class Animal end class Cat < Animal end myVar = Cat.new #puts myVar.superclass puts myVar.class
true
e5ac8c3f6e8881ce69ae2a5aceca9ce6429fbe64
Ruby
rlcheng/tic_tac_toe
/player_test.rb
UTF-8
726
3.34375
3
[]
no_license
require 'minitest/autorun' require_relative "player" describe "Player" do describe "initialize" do it "should create player to go first" do player = Player.new(1) assert_equal('X', player.marker) assert_equal(1, player.turn) end it "should create player to go second" do player = ...
true
f0256a1934204cf62e60c31dbe8dca1a133ffc24
Ruby
dan3lson/geometric_classes
/lib/circle.rb
UTF-8
305
3.34375
3
[]
no_license
class Circle #include Squarcle attr_reader :radius, :x, :y PIE = 3.14159265358979 def initialize(radius, x = 0, y = 0) @radius = radius @x = x @y = y end def diameter radius * 2 end def area (radius**2) * PIE end def perimeter 2 * PIE * radius end end
true
0587776349c5d8c74a22f4d8c8b9db1cc4e15431
Ruby
MaratMikushkin/RubequeTasks
/lib/fibonacci.rb
UTF-8
144
3.375
3
[]
no_license
class Fibonacci def fibo_finder(n) return 0 if n == 0 return 1 if n == 1 return fibo_finder(n - 1) + fibo_finder(n - 2) end end
true
e111a0ec7f1e5affc01d4446776abadbf0a48788
Ruby
Gilblasse/ruby-enumerables-cartoon-collections-lab-online-web-prework
/cartoon_collections.rb
UTF-8
716
3.359375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'pry' def roll_call_dwarves(dwarves) dwarves.map.with_index {|name,i| p "#{i+1}. #{name}\n"} end def summon_captain_planet(array) array.collect {|item| "#{item.capitalize}!"} end def long_planeteer_calls(array) character_test = array.reduce([]) do |memo, word| if word.length > 4...
true
4873849056b02f6271f810847151a83bc8faf9ae
Ruby
JoshuaMcEvoy/WDi24-Homework
/madeleine_milasas/week_10/day_01/tweeteater/lib/tasks/twitter.rake
UTF-8
1,512
2.640625
3
[]
no_license
namespace :twitter do desc "Destroy all users and tweets" task :clear => :environment do User.destroy_all Tweet.destroy_all Rake::Task['twitter:stats'].invoke end desc "Prints stats" task :stats => :environment do puts "Users: #{ User.count }, Tweets: #{ Tweet.count }" end desc "Populate...
true
fa7aac014c389e4920d2880e27e566852470f4cb
Ruby
jasonpilz/Headcount
/lib/district_repository.rb
UTF-8
756
2.875
3
[]
no_license
require_relative 'district' require 'csv' require 'csv_parser' class DistrictRepository attr_reader :districts def initialize(districts) @districts = districts end def self.from_csv(data_dir) filename = Dir.glob("#{data_dir}/*").first districts = {} CSV.foreach(filename) do |row| unless...
true
d6efc6ef3b68073ad6e91ee3ac1543f33ed9ef97
Ruby
tdooner/hvz-by-event
/activerecordmodels/check_in.rb
UTF-8
1,034
2.53125
3
[]
no_license
class CheckIn < ActiveRecord::Base belongs_to :registration def self.get_location(hostname) nord = [/[0-9a-z]*\.scl.case.edu/, /[0-9a-z]*\.scl.cwru.edu/] wade = [/benewah.stuaff.cwru.edu/, /acpe-184-59-134-35.neo.res.rr.com/, /minnehaha.stuaff.cwru.edu/, /antrim.stuaff.cwru.edu/, /lapeer.stuaff.cwru.edu/] ...
true
ae2e6c72aa81f18394d0e94e29e3b9e19433b92f
Ruby
troynt/AdventOfCode2019
/challenges/8/space_image_format_spec.rb
UTF-8
765
2.984375
3
[]
no_license
require_relative 'space_image_format' describe 'SpaceImageFormat', :day8 do def with_data(file_path) cur_dir = File.dirname(__FILE__) f = File.open(File.join(cur_dir, file_path)) nums = f.readlines.join.strip.chars SpaceImageFormat.new(nums) end it 'should be able to handle input data for part...
true
87ade653ef0e6c16807a7a1057529fcbaaf21485
Ruby
DuldR/AppAcaRuby
/Enum/Enumerables/Projects/Enum/lib/junk.rb
UTF-8
298
3.765625
4
[]
no_license
def say_hi(spc = "") returnStr = "" self.each do |ele| returnStr += (ele + spc) end returnStr end # "howdy".say_hi("nani?!") # def add(arr) # inB = "" # arr.each do |ele| # inB += ele # end # inB # end # butts = ["a", "b", "c"] # p add(butts)
true
ab286ec3b9f417eb3591dc15e1620810871f2a0a
Ruby
alibby/jasper-client
/lib/jasper-client/string.rb
UTF-8
535
2.84375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# Logic for both of these were lifted from the rails # source tree. We don't call active support directly because # we didn't want to depend on those gems merely for these # two bits of functionality. class String def underscore word = self.to_s.dup word.gsub!(/::/, '/') word.gsub!(/([A-Z]+)([A-Z][a-z])/...
true
9a5d0533004aa31a4f443484a0992dd44b46d214
Ruby
jcompagni10/AA_Projects
/w3d2/questions/question_likes.rb
UTF-8
1,540
2.703125
3
[]
no_license
class QuestionLikes def self.likers_for_question(question_id) users = QuestionsDatabase.instance.execute(<<-SQL, question_id) SELECT users.fname, users.lname, question_id FROM question_likes JOIN users ON users.id = question_likes.user_id WHERE ...
true
4c861c7daba9b0054e33579a96a60ea8c8539b86
Ruby
mfssanhueza/desafio_estructuras_control
/ej23.rb
UTF-8
254
3.859375
4
[]
no_license
# Mostrar todos los divisores del número 990 con 'while', 'for' y 'times'. # a = 1 # while a <= 900 # puts a if 900%a == 0 # a += 1 # end # for i in 1..900 do # puts i if 900%i == 0 # end 900.times do |i| puts i+1 if 900%(i+1) == 0 end
true
ca83a17fb6072c7c323db307895198f76ac2ce37
Ruby
sbouras518/W2D3
/01_pyramids.rb
UTF-8
1,274
3.34375
3
[]
no_license
def half_pyramid p "Salut, bienvenue dans ma super pyramide ! Combien d'étages veux-tu ?" stair = gets.chomp.to_i p "Voici la pyramide :" k=0 while stair >=1 puts " " * stair + "#" * k+=1 stair -=1 end end def full_pyramid p "Salut, bienvenue dans ma full pyramide ! Combien d'étages veux-t...
true
6ce7c3cefd22d681dcf28e8a15867ad3faeb9685
Ruby
rgsoto/LaunchSchool
/methods_ex1.rb
UTF-8
64
3.28125
3
[]
no_license
def greeting(name) "Hi, " + name end print greeting("reni")
true
29616e070c0278c3a4c216e944332b686165c39a
Ruby
biksod11/reverse-each-word-onl01-seng-pt-030220
/reverse_each_word.rb
UTF-8
99
3.265625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(list) list.split(" ").collect {|seperate| seperate.reverse!}.join(" ") end
true
2edb4708cdce0912a270ee420b9f4559eefddb9e
Ruby
hoksilato/CoderRestaurant
/app/models/dish.rb
UTF-8
451
2.53125
3
[ "Apache-2.0" ]
permissive
class Dish < ActiveRecord::Base belongs_to :menu paginates_per 9 validates :name, presence: true, length: { minimum: 5 }, uniqueness: true validates :price, presence: true validates_numericality_of :price, :greater_than => 0 validates_associated :menu validates_e...
true
c2878a13c8b6a97a66cee5379aed7bb6cbe1ba72
Ruby
mohammadaliawan/launch_school_RB101
/small_problems_3/medium_2/4sum_square_done.rb
UTF-8
2,679
4.46875
4
[]
no_license
# Sum Square - Square Sum # Write a method that computes the difference between the square of the sum of the # first n positive integers and the sum of the squares of the first n positive integers. # Examples: # sum_square_difference(3) == 22 # # -> (1 + 2 + 3)**2 - (1**2 + 2**2 + 3**2) # sum_square_difference(10...
true
49760b33fdab0211c5a8b185dd54c2a34f474fc8
Ruby
chelseaworrel/sales_engine
/lib/customer_repository.rb
UTF-8
1,942
3.078125
3
[]
no_license
require_relative 'load_file' require_relative 'customer' class CustomerRepository attr_reader :customers, :sales_engine include LoadFile def initialize(sales_engine) @customers = [] @sales_engine = sales_engine end def load_data(path) file = load_file(path) @customers = file.map do |line| ...
true
f0e1025995fc09acef01aed603fdc60306a5d6ce
Ruby
bthooper/sinatra-mvc-lab-v-000
/models/piglatinizer.rb
UTF-8
633
3.546875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class PigLatinizer attr_reader :text def initialize(text = '') @text = text end def piglatinize(text) pig_words = [] words = text.split words.each do |word| pig_words << latin_word(word) end pig_words.join(" ") end private def latin_word(word) word = word.strip ...
true
c46badd390a63f2e47c9046b338f40984010b326
Ruby
lynchd2/assignment_web_server
/google.rb
UTF-8
444
2.71875
3
[]
no_license
# google.rb require 'httparty' class Google include HTTParty base_uri 'google.com' def initialize(search_string) @options = { query: {q: search_string} } end def questions self.class.get("", @options) end end #google = Google.new("Viking Code School") #puts google.questions class Local in...
true
5dc3e5065ad5cf9af8a75bc7fcd9b976ba226504
Ruby
valogopedina/takeaway-challenge
/spec/takeaway_spec.rb
UTF-8
2,036
3.125
3
[ "MIT" ]
permissive
require 'takeaway' RSpec.describe Takeaway do let(:messager) {double :messager} let(:menu) {double :menu, show_menu: {"chicken" =>3, "rice" =>1, "pizza" =>6, "chips" =>2 } } subject(:takeaway) {described_class.new(menu, messager)} before do allow(menu).to receive(:price_of).with("c...
true
0a22ed3109fe1202191a1e63ae77ad0b9bfdf202
Ruby
lizzyjacobs/the-bachelor-todo-web-1116
/lib/bachelor.rb
UTF-8
1,120
3.609375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def get_first_name_of_season_winner(data, season) data[season].each do |person_hash| if person_hash["status"] == "Winner" return person_hash["name"].split(" ").first end end end def get_contestant_name(data, occupation) data.each do |season, season_array| season_array.each do |person_hash| ...
true
333293ec42d0dad60efb18672849483c4c7a9bd7
Ruby
Lewington-pitsos/steel_balls
/rubyscripts/logic/state_evaluator/scorer_manager.rb
UTF-8
1,479
3.59375
4
[]
no_license
# gets passed in an array of rated selections mapped to rated states # first it checks if any selectors are winners. # => If there are any winners, these are all scored at 0, and used to make an array of scored selection objects. The score for the sate is set to 1. # => otherwise the array of rated selections is pas...
true
9bc678f485cb534affdf91b6cd80a8206c643e5e
Ruby
anergictcell/GeneTable
/main.rb
UTF-8
1,242
3.125
3
[]
no_license
# Script to read data tables and analyze based on trivial value comparisons # can be used eg for Gene expression or ChIP-seq analysis # written by Jonas Marcello (rujmarcello@gmail.com) # can be used/modified freely for any peaceful purpose # Aknowledgment would be nice, though DataPoint = Struct.new(:symbol, :da...
true
374469bda7ac253561eb46ddc72c1b05279dfae5
Ruby
amyjording/project_ruby
/08_book_titles/book.rb
UTF-8
285
3.40625
3
[]
no_license
class Book attr_accessor :title def title little_words = %w{the and or to with before for of over under in beside behind but a an} @title.split.each_with_index.map{|word, index| little_words.include?(word) && index > 0 ? word : word.capitalize }.join(" ") end end
true
549b187c535feb7a68e28d0aa71f91791260838e
Ruby
TranscendComputing/CloudMux
/app/source_control_repository_api_app.rb
UTF-8
1,797
2.703125
3
[ "Apache-2.0" ]
permissive
require 'sinatra' class SourceControlRepositoryApiApp < ApiBase # Get a SC Repo by ID get '/:id' do repo = SourceControlRepository.where(id:params[:id]).first if repo.nil? [NOT_FOUND] else [OK, repo.to_json] end end # Get SC Repo for org ...
true
4a07cdd0f9fc3290cea479ed4650d9aa521e4445
Ruby
ilyapalkin/cs169.1x
/hw1/part3.rb
UTF-8
1,689
3.515625
4
[]
no_license
def combine_anagrams(words) # YOUR CODE HERE anagrams = Hash.new words.each { |word| key = word.downcase.chars.sort.join anagrams[key] ||= [] anagrams[key] << word } return anagrams.values end # #specs # On Time # anagrams # should handle an empty array [2 points] # should handle the most simple, sing...
true
82a4ba1f91d530efd351e090f3fc18de4242d24f
Ruby
WilliamDeLaEspriella/lcd_refactor_psl
/digit.rb
UTF-8
630
3.109375
3
[]
no_license
require './adapter/digit_adapter' require './digits/one' require './digits/two' require './digits/three' require './digits/four' require './digits/five' require './digits/six' require './digits/seven' require './digits/eigth' require './digits/nine' require './digits/zero' class Digit include DigitAdapter de...
true
3697ee84915ab29bca39131615c6a933c48128f9
Ruby
codegourmet/lambda_validators
/lib/lambda_validators/data_validator.rb
UTF-8
1,167
3.078125
3
[ "MIT" ]
permissive
module LambdaValidators # TODO README # TODO RDOC # # NOTE (todo move into doc) validator validates only once, since # some validations might be based upon others being successful # example: # data["key_1"].present? # data["key_1"]["key_2].present? # # if the validator doesn't abort a...
true
fa734c18b8dea124615ad591fec48a21891b19cc
Ruby
condorcork/learnRuby
/test/get_patnDat.rb
UTF-8
675
2.671875
3
[]
no_license
def get_PtnDat2( ptn, *matchN ) puts "Enter #{ptn}" puts "#{ptn}" cs=1 case matchN.size when 2 case matchN[1] when 2 cs=2 when 3 cs=3 when 4 cs=4 end end while true l=gets if l =~ /#{ptn}/ x=$1 case cs when 1 y=nil ...
true
c022f569b0b8787121795c0ac449d7d6131417b9
Ruby
SabineLoss/markdown-tools
/mdc/test/parser_state_test.rb
UTF-8
698
2.796875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- require 'minitest/autorun' require_relative '../lib/parsing/parser_state' ## # Tests for the class ParserState class ParserStateTest < Minitest::Test ## # Test for the automatic methods regarding the state def test_state_methods ps = Parsing::ParserState.new(nil, '', 1, :STATE_1, :...
true
238c7c36e94b2d0ad0812b73d63d6f266bc3ec2a
Ruby
thetomcoffee/RubyProgs
/blanket_patterns.rb
UTF-8
496
3.90625
4
[]
no_license
#try with loops and iterators colors = "!!@@\#\#$$%%" puts colors #my answer 1: # 20.times do # first_symbol = colors[0] # i = 1 # output = "" # while i < colors.size # output << colors[i] # i += 1 # end # output << first_symbol # puts output # colors = output # end #my answer 2: # i = 0 # u...
true
8bb29dc0c792e8540426ceba72b718f29bcd2912
Ruby
patkun/iris
/etc/old.rb
UTF-8
2,366
2.640625
3
[]
no_license
#!/usr/bin/env ruby # -*- coding: utf-8 -*- #require 'pandoc-ruby' handoutcss = "#{File.dirname(__FILE__)}/iris.d/handout.css" mdfile = ARGV.last pdffile = mdfile.gsub(/(md|txt|org|[a-z]+)$/,"pdf") htmlfile = mdfile.gsub(/(md|txt|org|[a-z]+)$/,"html") markdownfile = mdfile.gsub(/(md|txt|org|[a-z]+)$/,"plain.md") t =...
true
6d0471ebaba9597fc8717c9f14db31105c7589ae
Ruby
morimoto-kazuma/GEEKJOB_Challenge
/CampChallenge_Ruby/000.基礎/suchi.rb
UTF-8
157
2.890625
3
[]
no_license
NUM = 3.14 num = 3 num1 = 5 num2 = 7 num3 = 9 total = NUM + num + num3 total1 = NUM + num * num1 total2 = NUM % 2 print total.to_i puts total1 puts total2
true
fa1f5a0c6273cf77b65344df5db234274ab63f5a
Ruby
TomK32/learnsprout
/lib/learnsprout/course.rb
UTF-8
640
2.578125
3
[]
no_license
module LearnSprout class Course attr_accessor :id, :course_id, :school_id, :name, :number, :time_updated, :updated_at def initialize(attrs={}) @client = attrs["client"] @org_id = attrs["org_id"] self....
true
716cde14d4c0a98524de1a93b3486b65031b1636
Ruby
CodeKrakken/christmas-battle
/lib/game.rb
UTF-8
570
3.4375
3
[]
no_license
class Game attr_reader :active_player attr_reader :passive_player def initialize(player_1, player_2) @player_1, @player_2 = player_1, player_2 @active_player, @passive_player = player_1, player_2 end def attack(player) player.receive_damage end def player_1 @player_1 end def play...
true
4c7ea3e571017ed408b39019383fd696f5ee84f3
Ruby
SlevinKelevra/thinknetica
/Lesson7/passenger_wagon.rb
UTF-8
302
3.03125
3
[]
no_license
require_relative 'modules' class PassengerWagon include Manufacturer attr_reader :free_place def initialize(place) @place = place.to_i @free_place = @place end def busy_place @place - @free_place end def take_place @free_place -= 1 unless @free_place.zero? end end
true
0cb01718e503cb7a16e8498c13a343c19c4174b5
Ruby
tylerseawell4/ruby
/HangMan.rb
UTF-8
2,445
4.3125
4
[]
no_license
class Hangman attr_accessor :player, :guesses def initialize (player, guesses) @player = player @guesses = guesses end def greeting @total_array=[] puts "Let's play a game of Hangman!" puts "Player, what is your name?" @player = gets.chomp.capitalize puts "Hello, #{@player}! Let's get started." p...
true
ea0936b746dfb2acdf188311cd44ecc2338d010d
Ruby
M-L-V/imdb-lab
/models/movie.rb
UTF-8
1,012
3.1875
3
[]
no_license
require('pg') require_relative('../db/sql_runner.rb') class Movies attr_reader :title, :genre, :id attr_accessor :title, :genre def initialize(options) @title = options['title'] @genre = options['genre'] @id = options['id'].to_i if options['id'] end def save db = PG.connect({ dbname: 'imdb_lab', hos...
true
4711733a6ca682ede6010d02b1937364f17bc2be
Ruby
Pklong/chess
/board.rb
UTF-8
3,870
3.546875
4
[]
no_license
class Board attr_reader :grid def initialize @grid = Array.new(8) { Array.new(8) } end def [](pos) row, col = pos @grid[row][col] end def []=(pos, piece) row, col = pos @grid[row][col] = piece end def castling?(king_pos, rook_pos) self[king_pos].class == King && self[ro...
true
0c9ad63c7bb2c14f698a5842d02480d9ce0365d8
Ruby
edikgat/code_example_bakery
/spec/models/order_spec.rb
UTF-8
2,188
2.609375
3
[]
no_license
# frozen_string_literal: true describe BakeryApp::Order do subject(:order) { described_class.new(shop: shop) } let(:shop) { BakeryApp::Shop.new(name: 'Bakery') } let(:good) { BakeryApp::Good.new(name: 'Vegemite Scroll', code: 'VS5', shop: shop) } let(:first_package) { BakeryApp::GoodPackage.new(good: good, we...
true
c2885391fa4fab4def89751720e4be2e56717cd5
Ruby
ScutinPutin/COS10009-Introduction-to-Programming
/9.1T/basic_read_write.rb
UTF-8
1,216
4.03125
4
[]
no_license
# writes the number of lines then each line as a string. def write_data_to_file(aFile) aFile.puts('5') aFile.puts('Fred') aFile.puts('Sam') aFile.puts('Jill') aFile.puts('Jenny') aFile.puts('Zorro') end # reads in each line. # you need to change the following code # so that it uses a loop which rep...
true
385cbf87f0875a03ca11e7494cb14be5d2802a3e
Ruby
charlie-galb/Battleships
/lib/player.rb
UTF-8
3,076
3.75
4
[]
no_license
require_relative 'carrier' require_relative 'destroyer' class Player attr_reader :board, :unpositioned_ships, :active_ships, :shots_record def initialize(unpositioned_ships = [Carrier.new, Destroyer.new]) @board = Array.new(8) {Array.new(8) {"O"}} @unpositioned_ships = unpositioned_ships ...
true
78be9479ba588ee493a0d366ed338e355ebcee0f
Ruby
ChadoNihi/the_odin_project_assignments
/learn_ruby/02_calculator/calculator.rb
UTF-8
248
3.640625
4
[]
no_license
def add(x,y) x+y end def subtract(x,y) x-y end def sum(args) args.empty? ? 0 : args.inject {|sum, x| sum+x} end def multiply(*args) args.reduce(1) {|pr,x| pr*x} end def power(x,y) x**y end def factorial(x) x==0 ? 1 : x*factorial(x-1) end
true
0f1bcecce5d02ecc236efbc469d9df581b50b008
Ruby
ewkruljac/project_cli_connect_four
/connect_four/ai.rb
UTF-8
4,112
3.703125
4
[]
no_license
#require "./board" class AI attr_accessor :name, :piece def initialize(name = "Dumb AI", piece, board, player_1) raise "Piece must be a Symbol!" unless piece.is_a?(Symbol) @name = name @piece = piece @board = board @player_1 = player_1 end #---------- def get_column r = rand(0.....
true
89e6e9ec718cc4aff9eb97310345156840a8db6c
Ruby
thomasfrl/polonais
/lib/tasks/word.rake
UTF-8
3,985
2.625
3
[]
no_license
require 'nokogiri' require 'open-uri' namespace :word do desc "TODO" task init: :environment do File.open('/home/thomas/Documents/Polonais/polish.txt', 'r') do |file| file.each do |line| content, counter = line.split unless FakeWord.all.pluck(:content).include? content FakeWord....
true
0047f6419594c765932ad31d876b42fc1dd06d34
Ruby
darryllittman/w2d4
/execution_time_difference.rb
UTF-8
1,310
3.640625
4
[]
no_license
require 'byebug' def my_min_p1(list) smallest = list.first i = 0 while i < list.length - 1 j = 0 while j < list.length - 1 smallest = list[i] if list[i] < smallest j += 1 end i += 1 end # list.each do |el1| # i = 0 # while i < list.length - 1 # smallest = el1 if el...
true
6609916f7f0e77dd2f34a5882084402239951c19
Ruby
alexgyllos/properties
/models/property.rb
UTF-8
2,878
3.046875
3
[]
no_license
require('pg') class Property attr_accessor :address, :value, :year_built, :build attr_reader :id def initialize(options) @address = options['address'] @value = options['value'] @year_built = options['year_built'] @build = options['build'] end def save() db = PG.connect({dbname: 'proper...
true
23ef7540f09a21ae771a884df6e3d74ebb56319c
Ruby
dachinat/Passgen
/lib/passgen.rb
UTF-8
8,365
2.75
3
[ "MIT" ]
permissive
#= Passgen # #Ruby gem for generating passwords quickly and easily. Although it is #suitable for use within Rails it has no Rails dependencies and can be used in #non-Rails applications as well. # #== Install # # gem install cryptice-passgen --source http://gems.github.com # #== Usage # #The usage could not be easier....
true
3ebd66cc1bdefe8bb99c5672728e32ad2360c123
Ruby
HaopengLiu-1992/leetcode-ruby
/test/70_Climbing_Stairs_Test.rb
UTF-8
254
2.75
3
[ "ICU", "Ruby" ]
permissive
require 'test/unit' require_relative '../leetcode/70_Climbing_Stairs' class ClimbingStairsTest < Test::Unit::TestCase def setup @test = ClimbingStairs.new end def test_solution res = @test.climb_stairs(1) assert_equal res, 1 end end
true
cd256840b527cf53df1215fe8ec083185b722fab
Ruby
curationexperts/mahonia
/app/lib/mahonia/identifier_registrar.rb
UTF-8
1,004
2.671875
3
[ "Apache-2.0" ]
permissive
# frozen_string_literal: true module Mahonia class IdentifierRegistrar class << self ## # @param type [Symbol] # @param opts [Hash] # @option opts [Mahonia::IdentifierBuilder] :builder # # @return [IdentifierRegistrar] a registrar for the given type def for(type, **opts)...
true
3907b07ffdd6820d9617c27af41e9490e82e8fea
Ruby
wahaj/TextMusicPlayer
/basic_music_player.rb
UTF-8
12,592
3.234375
3
[]
no_license
require './input_functions' require 'ffi' module Genre POP, CLASSIC, JAZZ, ROCK = *1..4 end module VLC extend FFI::Library ffi_lib 'vlc' attach_function :version, :libvlc_get_version, [], :string attach_function :new, :libvlc_new, [:int, :int], :pointer attach_function :libvlc_medi...
true
0177bab764d1582c29e74a86549c879ddbd05383
Ruby
DavidMejia025/runa_hr_test
/db/seeds.rb
UTF-8
1,807
2.765625
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
true
07a81a257ffaad7829322f78e23f5f126da7a822
Ruby
babun52/Triangle_Checker
/spec/triangles_spec.rb
UTF-8
907
3.46875
3
[ "Ruby" ]
permissive
require('rspec') require('pry') require('triangles') describe('Triangle') do describe('#check_triangle') do it('will return equilateral if all sides are equal') do new_triangle = Triangle.new(2,2,2) expect(new_triangle.check_triangle()).to(eq('equilateral')) end it('will return isosceles if e...
true
352e38f52819710559987eaa12f6ed38dc9ae52e
Ruby
daleterrell/Practical
/lib/Practical/movie.rb
UTF-8
484
2.5625
3
[ "MIT" ]
permissive
class Practical::Movies attr_accessor :title, :rating, :critic, :url, :directed_by, :id attr_reader :reviews @@all = [] def initialize(att_hash) # @title = att_hash[:title] #@rating = att_hash[:rating] att_hash.each do |key, value| self.send("#{key}=", value) end @reviews = [] sel...
true
73e4e3b4d5c28435750da8f1078b721fc2900bd3
Ruby
drewemartin/ruby_rspec_practice
/03_simon_says/simon_says.rb
UTF-8
501
3.828125
4
[]
no_license
def echo(word) word end def shout(word) word.upcase end def repeat(word, num = 2) ((word + " ") * num).chomp(" ") end def start_of_word(word, num) word[0..(num - 1)] end def first_word(phrase) phrase.split(" ").first end def titleize(phrase) ary = phrase.split(" ") ary.each do |word| if word == "the" && wo...
true
773fb515931c6c42171a72786fe4ef1abf338003
Ruby
epitron/backroom
/go.rb
UTF-8
1,166
2.640625
3
[]
no_license
require 'sinatra' require 'sinatra-websocket' require 'json' require 'haml' set :server, 'thin' $users = {} $logfile = "chat.log" $log = open($logfile, "a") $log.sync = true def lastlog(n=20) open($logfile) do |f| f.reverse_each.take(100).reverse end end def log(msg_hash) p msg_hash $log.puts(m...
true
21145e76cbba7c0b7698aa0a1efae7f088282c5b
Ruby
peijun333/ruby-book-codes
/chap04/4.2.2.rb
UTF-8
260
3.375
3
[]
no_license
a, b = [1,2] puts a puts b puts a + b c, d = [10] puts c puts d.class e, f = [100, 200, 300] puts e puts f quo_rem = 14.divmod(3) puts "商=#{quo_rem[0]}, 余り=#{quo_rem[1]}" quotient, remainder = 14.divmod(3) puts "商=#{quotient}, 余り=#{remainder}"
true
f86c628d8cfb9920af9c02f859d521f66860f839
Ruby
digideskio/racing_on_rails
/app/models/competitions/categories.rb
UTF-8
1,127
3.046875
3
[ "Ruby", "MIT" ]
permissive
module Competitions module Categories # Competition's races. Default to +category_names+ (e.g., Men A, Men B, …) # But some competitions have race names like "Team" or "Overall" drawn # from +source_result_category_names+. def race_category_names category_names end def source_result_cat...
true
3ee1487f09395b70f56fe26eeb6640dd561afc81
Ruby
Greutz/Exos
/exo_12.rb
UTF-8
144
2.90625
3
[]
no_license
total = 0 puts "donne un chiffre stp" print "> " nombre = gets.chomp.to_i nombre.times do total += 1 puts "Total = #{total.to_s}" end
true
95be2d5cc04d4da25af910f4d9f5f2ca955e667d
Ruby
teliosdev/liquidscript
/lib/liquidscript/compiler/icr/expressions.rb
UTF-8
5,389
2.8125
3
[ "MIT" ]
permissive
module Liquidscript module Compiler class ICR < Base module Expressions # Compiles an expression. This is primarily used in a general # context, such that anything can be returned. # # @return [ICR::Code] def compile_expression expect :if, :unless, :class,...
true
7db0f9f52d55c9a090cf3d5f73a8747441a56bb9
Ruby
ritchiey/cafebop-rails2.2
/test/unit/cuisine_test.rb
UTF-8
2,265
2.9375
3
[]
no_license
require 'test_helper' class CuisineTest < ActiveSupport::TestCase context "A couple of cuisines" do setup do @cuisine = Cuisine.make @franchise = Cuisine.make(:franchise=>true) end should "appear in the correct searches" do assert_same_elements [@cuisine], Cuisine.is_not_franchi...
true
7815b960676674076b444219602c57d8272c5458
Ruby
grosser/ruruby
/tests/app_mandel_perf.rb
UTF-8
1,563
3.734375
4
[]
no_license
# The Computer Language Benchmarks Game # http://shootout.alioth.debian.org/ # # contributed by Karl von Laudermann # modified by Jeremy Echols class Complexe attr_accessor(:r, :i) def initialize(r,i) @r=r; @i=i; end def *(c) Complexe.new(@r*c.r - @i*c.i, @r*c.i + @i*c.r) end def +(c) Compl...
true
73fd71797c2bd36b73766c860c09536ef13f4d95
Ruby
nicmlu/oo-barking-dog-online-web-pt-100719
/lib/dog.rb
UTF-8
158
3.296875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Dog def name=(dog_name) @chosen_name = dog_name end def name @chosen_name end def bark puts "woof!" end end
true
b19d76e2569f6e618d6ad8d0de341d1be9aff2db
Ruby
feigningfigure/WDI_NYC_Apr14_String
/w02/d05/Dara_Mao/morning_exercise/name_app.rb
UTF-8
1,036
3.484375
3
[]
no_license
spring_wdi = ["Joe Park", "Artem Murga", "John Randall", "Wilson Chan", "Nelson Schubart", "Christopher Bajorin", "Christopher Lee", "Ben Ticsay", "Joel Rosenblatt", "Declan Van Welie", "Andrew Wallace", "Emmanuel Tucker", "Nancy Ko", "Dara Mao", "Jonathan Milgrom", "Liz Goldstein", "Jane Shin", "Victor Rodriguez", "Da...
true
6ec3a9e6a17261e2bc198bed9d5b6659330fce61
Ruby
kenexllc/peatio
/app/models/operations.rb
UTF-8
1,341
2.515625
3
[ "MIT" ]
permissive
# encoding: UTF-8 # frozen_string_literal: true module Operations class << self # TODO: Add specs for this function. def build_account_number(currency_id:, account_code:, member_uid: nil) [currency_id, account_code, member_uid].compact.join('-') end def split_account_number(account_number:) ...
true
808b1621ed7b0742424d4a80d58dd03d0c6efe98
Ruby
Bathula/uncb_project
/test/unit/regex_test.rb
UTF-8
4,489
2.59375
3
[]
no_license
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') class RegexTest < ActiveSupport::TestCase R = Regex # Test R::REGEX_EMAIL GOOD_EMAILS = [ "bill@microsoft.com", "bill.gates@netcentrics.com", "bill_gates@netcentrics.com", "bill-gates@netcentrics.com", "bill@host.microsoft...
true
3e3432838a82c4e1055da3671baa3911bae5dd97
Ruby
samvera/hyrax
/app/utils/hyrax/test_data_seeders/collection_seeder.rb
UTF-8
3,891
2.609375
3
[ "Apache-2.0" ]
permissive
# frozen_string_literal: true module Hyrax module TestDataSeeders # This class was created for use in rake tasks and db/seeds.rb. It generates # collection that can be used in release testing. This data can also be helpful # for local development testing. # # Adding collections is non-destructiv...
true
5fde0978ca00cfe425df6908f8fecf04e267280e
Ruby
mpraglowski/rails_event_store
/contrib/multiple_databases_repository_sample_app/shipping/lib/shipping/shipping_process.rb
UTF-8
1,374
2.515625
3
[ "MIT" ]
permissive
module Shipping class ShippingProcess def initialize(event_store, bus) @event_store = event_store @bus = bus end def call(event) with_linked(event) do |state| bus.call(state.command) if state.done? end end private attr_reader :event_store, :bus class Stat...
true
516826405462dde5290e35befd04a394d4f83669
Ruby
Metloff/easy_geometry
/lib/easy_geometry/d2/point.rb
UTF-8
5,603
3.546875
4
[ "MIT" ]
permissive
module EasyGeometry module D2 # A point in a 2-dimensional Euclidean space. class Point attr_reader :x, :y EQUITY_TOLERANCE = 0.0000000000001 def initialize(x, y) @x = x; @y = y validate! converting_to_rational! end # Project the point 'a' onto the lin...
true
13f04ff1568beb30bc035a618a6aab7fccc085ee
Ruby
Wei-N-Ning/rubyFoo
/variables/instance_var.rb
UTF-8
295
3.375
3
[]
no_license
#!/usr/bin/env ruby # scope to the instance; sharable among different methods class Task def compute @queue = 2 end def result p @queue end end def demo_instance_var t1= Task.new t1.compute() t1.result() # 2 t2 = Task.new t2.result() # nil end demo_instance_var
true