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
c6132a88aa39f06e7d58c242999d64974c855c0c
Ruby
mustache/mustache
/test/fixtures/lambda.rb
UTF-8
459
2.71875
3
[ "MIT" ]
permissive
require 'mustache' class Lambda < Mustache self.path = File.dirname(__FILE__) attr_reader :calls def initialize(*args) super @calls = 0 @cached = nil end def rendered lambda do |text| return @cached if @cached @calls += 1 @cached = render(text) end end def not_r...
true
0b51c8886c295b935d93c11a0ed3cca00432903e
Ruby
kanpou0108/launchschool
/intro_ruby_programming_exercises/9_more_stuff/5_error.rb
UTF-8
519
3.734375
4
[]
no_license
# Why does the following code... # Give us the following error when we run it? # # block.rb1:in `execute': wrong number of arguments (0 for 1) (ArgumentError) # from test.rb:5:in `<main>' def execute(block) block.call end execute { puts "Hello from inside the execute method!" } # we are not passing any argument t...
true
432fd92ce4ce106fb1538125cdf5cd12553e5427
Ruby
cmvandrevala/footprints-public
/lib/crafters/crafters_interactor.rb
UTF-8
488
2.75
3
[]
no_license
class CraftersInteractor attr_reader :crafter class InvalidData < RuntimeError end def initialize(crafter) @crafter = crafter end def update(attributes) validate(attributes) crafter.update!(attributes) rescue ActiveRecord::RecordInvalid => e raise InvalidData.new(e.message) end pr...
true
0d45a216a2639b949d1f6d39bb697967a39a07c9
Ruby
ChrstphGrnr/activerecord-tvland-online-web-ft-021119
/app/models/actor.rb
UTF-8
413
2.640625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Actor < ActiveRecord::Base has_many :characters has_many :shows, through: :characters def full_name self.first_name + " " + self.last_name end def list_roles chars = self.characters.map {|c| c.name} shows = self.shows.map{|s| s.name} chars_and_shows = [] chars.each_with_index do |c...
true
99a442790ce4a7c2b5e8ab1e1c24e1e2bc55fc21
Ruby
goyalmunish/structure_flatter
/lib/structure_flatter/array_hash_structure.rb
UTF-8
2,304
3.625
4
[ "MIT" ]
permissive
require 'active_support/core_ext/string' module StructureFlatter class ArrayHashStructure attr_reader :ahs # Initializing element # passed structure should be a simple or complex structure comprising Hashes and Arrays def initialize(array_hash_structure = nil) @ahs = array_hash_structure ...
true
baee0b281b5da3dd0d9770dc3603a3cfc96bc24a
Ruby
Lewington-pitsos/launch_excercises
/small_problems/excercise_5/q7.rb
UTF-8
194
3.046875
3
[]
no_license
def counter str hash = Hash.new(0) str.split(" ").each do |i| i.gsub!(/\W+/, "") hash[i.length] += 1 end hash end p counter ('Hey diddle diddle, the cat and the fiddle!')
true
dd63922507b6ed0447cea5caa5d9fec26c6c380c
Ruby
95-Samb/advent-of-code
/2019-day 2/spec/intcode_spec.rb
UTF-8
2,204
2.828125
3
[]
no_license
# frozen_string_literal: true require_relative '../intcode.rb' describe Intcode do context 'for a single 4 opcode before 99' do it 'returns 2,0,0,0,99 for 1,0,0,0,99' do expect(Intcode.new.execute([1, 0, 0, 0, 99])).to eq([2, 0, 0, 0, 99]) end it 'returns 2,1,0,0,99 for 1,1,0,0,99' do expect...
true
f772334254fe5d112c1527c8c5422af3d13de9b6
Ruby
dddotcom/algorithms_practice
/sorting/merge_sort/ruby_merge_sort.rb
UTF-8
690
4.0625
4
[]
no_license
def merge_sort(arr) if arr.length <= 1 return arr end middleIndex = (arr.length/2).floor leftArr = arr[0...middleIndex] rightArr = arr[middleIndex...arr.length] return merge(merge_sort(leftArr), merge_sort(rightArr)) end def merge(leftArr, rightArr) mergedArr = [] while leftArr.length > 0 && right...
true
249e08252ec6caf490d5e9e591443a123d85ec69
Ruby
mechnicov/credit-card-checker
/spec/credit_card_checker_spec.rb
UTF-8
1,263
2.703125
3
[]
no_license
require 'credit_card_checker' RSpec.describe CreditCardChecker do describe '.identify_type' do context 'input is correct' do let(:cards) { %w(371234567890123 6011123456789012 5412345678901234 4417123456789112 123456...
true
94cd9278c3b820fba39f0a0e54adb7a4435ea20f
Ruby
AngelChaos26/openpay-solidus-ruby
/config/initializers/error.rb
UTF-8
810
2.53125
3
[]
no_license
Conekta::Error.class_eval do attr_reader :category, :description, :http_code, :error_code, :request_id, :fraud_rules def initialize(options={}) @category = options["category"] @error_code = options["error_code"] @request_id = options["request_id"] #if options["details"] #@de...
true
555d21aed13bbaf8c56de92b1fec0e32ce924374
Ruby
watir/watir
/lib/watir/scroll.rb
UTF-8
2,871
2.796875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# frozen_string_literal: true module Watir module Scrolling def scroll Scroll.new(self) end end class Scroll def initialize(object) @driver = object.browser.wd @object = object @origin = nil end # Scrolls by offset. # @param [Fixnum] left Horizontal offset # ...
true
539771cab2906f501be64e6ba7196960f12671f5
Ruby
jsuich/Flashcards
/test.rb
UTF-8
668
2.828125
3
[]
no_license
# Richard and Josh's version class Controller attr_reader :deck, :view def initialize(src_file, view = View.new) @deck = Deck.new(parse_file(src_file)) @view = view end def parse_file open() end def run_game def execute(command, args) case command when 'deck' view.render(dec...
true
beb69616947ec3adfa54040f7d371d090e128dae
Ruby
GalaxyAstronaut/Portfolio
/three.rb
UTF-8
168
3.78125
4
[]
no_license
def sum_of_elements(array) sum = 0 array.each do |el| sum += el end sum end puts sum_of_elements([1,2,3]) puts sum_of_elements([10,20,30])
true
ce9788f32b149811c0781f55a40f7d658cc752c1
Ruby
brlst16/ruby-object-attributes-lab-onl01-seng-pt-120819
/lib/dog.rb
UTF-8
375
3.609375
4
[]
no_license
class Dog # setter method where the argument is set equal to the instance variable def name=(dog_name) @name = dog_name end # getter method where the instance variable in the setter method is ? def name @name end # setter method for breed def breed=(dog_breed) @breed = dog_br...
true
316b86819aac3a86ef47be034e01280bbe2e0b61
Ruby
SimpleFinance/chef-handler-cookbook-copy
/lib/chef-handler-cookbook-copy.rb
UTF-8
1,769
2.71875
3
[ "Apache-2.0" ]
permissive
# lib/chef-handler-cookbook-copy.rb # # Author: Simple Finance <ops@simple.com> # Copyright 2013 Simple Finance Technology Corporation. # Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a ...
true
a4400fa345131c6b0e57c1062bc8bc1166c8533d
Ruby
wassi12495/collections_practice_vol_2-web-103017
/collections_practice.rb
UTF-8
1,738
3.734375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# your code goes here def begins_with_r(array) array.all? {|item| item.split("").first == "r"} end def contain_a(array) a_words = [] array.each do |word| if word.split("").any?{|letter| letter == "a"} a_words << word end end a_words end # Return first element that starts with "wa" def first_wa...
true
e04c4da2d88cfa8d0451441fbf21d024ca862f2f
Ruby
dhf0820/ids-core
/sys_models/deviceable.rb
UTF-8
1,394
3
3
[]
no_license
module Deviceable def add_device(device, primary) puts "Add Device to #{self.full_name} - #{device}" remove_device(device) if primary remove_primary set_primary(device) end new_device = {} new_device[:device_id] = device.id.to_s new_device[:device_name] = device.name new_device[:class_id] = devi...
true
e1793b5ed5906fdf9e4a0e8f420fd64268118130
Ruby
schmurfy/monitoring_protocols
/lib/monitoring_protocols/collectd/parser.rb
UTF-8
4,803
2.578125
3
[ "MIT" ]
permissive
module MonitoringProtocols module Collectd class Parser < Parser # part type HOST = 0x0000 TIME = 0x0001 TIME_HR = 0X0008 PLUGIN = 0x0002 PLUGIN_INSTANCE = 0x0003 TYPE = 0x0004 TYPE_INSTANCE = 0x0005 ...
true
763e799310fd1d91ebd735e4de63e5f34ffa1a2a
Ruby
katheroine/languagium
/ruby/strings/string_notation.rb
UTF-8
429
3.046875
3
[]
no_license
#!/usr/bin/ruby2.7 s = "hello" puts("\"hello\": #{s} (#{s.class})") s = 'hello' puts("'hello': #{s} (#{s.class})") s = %q(hello) puts("%q(hello): #{s} (#{s.class})") s = %Q(hello) puts("%Q(hello): #{s} (#{s.class})") s = %q[hello] puts("%q[hello]: #{s} (#{s.class})") s = %Q[hello] puts("%Q[hello]: #{s} (#{s.class...
true
e189c5a9b73615dce7f118fffa78be62e9bfb297
Ruby
nixsterchan/ProjectAnotherPin
/app/models/cart.rb
UTF-8
693
3.15625
3
[]
no_license
class Cart < ApplicationRecord has_many :order_items def total_quantity # go over each order item and add up @count = 0 # next, loop over each thing in the order item and add quantity to the count order_items.all.each do |item| # find the count and add one to it @count = @count + item....
true
896a8818bf06106a906269b5ea088533e6d19a07
Ruby
szabba/parallax2-polyglot
/ruby/parallax2.rb
UTF-8
4,911
2.9375
3
[]
no_license
require 'sdl' FOREGROUND_VEL_X = 100.0 FOREGROUND_VEL_Y = 50.0 SCREEN_W = 640 SCREEN_H = 480 TILE_W = 48 TILE_H = 48 MAP_W = 16 MAP_H = 16 class TiledLayer def initialize(map, tiles) @x = @y = 0 @v_x = @v_y = 0 @map = map @tiles = tiles end def x @x end ...
true
62a10168816851fbc605cf0b79baddff02ca70db
Ruby
UseK/CCParser
/lib/clone_set.rb
UTF-8
559
2.796875
3
[]
no_license
#encoding: utf-8 $LOAD_PATH << File.dirname(__FILE__) require "clone_piece" class CloneSet < Array def include_package? package @pkg_list ||= update_pkg_list @pkg_list.include? package.to_s end def update_pkg_list pkg_list = [] self.each do |cp| pkg_list << cp.package end pkg_list.u...
true
e3d0b794739aec7f1e796c43e62f06629ea9fb46
Ruby
hmcfletch/project-euler
/ruby/067.rb
UTF-8
1,425
4.0625
4
[]
no_license
# By starting at the top of the triangle below and moving to adjacent numbers on # the row below, the maximum total from top to bottom is 23. # 3 # 7 4 # 2 4 6 # 8 5 9 3 # That is, 3 + 7 + 4 + 9 = 23. # Find the maximum total from top to bottom in triangle.txt (right click and # 'Save Link/Target As...'), a 15K text...
true
261a5d525a20c27854f976bd536e726f796e57e9
Ruby
5shadesofr3d/Ruby-System-Shell
/filewatch/file_watcher.rb
UTF-8
4,832
2.921875
3
[ "MIT" ]
permissive
require_relative 'file_command_parser' require_relative '../precision/precision' require_relative '../shell/command' require 'test/unit' class FileWatcher include Test::Unit::Assertions def initialize(args) #pre assert args.is_a? Array args.each { |a| assert a.is_a? String } parser = FileCommandParser.new(...
true
f30b3a87fc9028aba309489b4b463c136ab43d0d
Ruby
bukk530/railsbook
/lib/railsbook/facebook_redirect_login_helper.rb
UTF-8
2,915
2.828125
3
[ "MIT" ]
permissive
require 'securerandom' require 'uri' #TODO: Implement this class as a Rails Helper class module RailsBook class FacebookRedirectLoginHelper def initialize(redirect_url, session, params) @redirect_url = redirect_url @session = session @params = params end # Params: # ...
true
79e8482d1802bb043e51cc42368f034954dfe83c
Ruby
edvfb9/support-plan
/app/models/time_slot.rb
UTF-8
1,159
2.59375
3
[]
no_license
class TimeSlot < ApplicationRecord has_many :semester_plan_connections belongs_to :semester_plan # returns day and start time by index/type of slot def self.find_slot_by_type(type) day = 0 time = 0 while type >= 4 type -= 4 day += 1 end days = ["Montag", "Dienstag", "Mittwoch", ...
true
2ca800d3303ebdbcab3d180ce9e37b52987e6e9d
Ruby
alechoey/trLOLing
/collection/file_factory/time_stamped_file_factory.rb
UTF-8
816
2.796875
3
[]
no_license
require 'fileutils' require_relative './file_factory' module FileFactory class TimeStampedFileFactory < FileFactory def initialize(dir_path, filename, file_extension='') @dir = dir_path @filename = filename @file_extension = file_extension FileUtils.mkpath(dir_path) end def e...
true
2d76cbe5bda88b760ba212098b5207702d1c9cd7
Ruby
durran/injectable
/lib/injectable/registry.rb
UTF-8
2,324
2.78125
3
[ "MIT" ]
permissive
# encoding: utf-8 require "injectable/registerable" module Injectable # The registry keeps track of all objects and their dependencies that need # to be injected at construction. # # @since 0.0.0 module Registry include Registerable extend self # Get an implementation for the provided name. ...
true
4facb6342d82263b04a42f8c9f09bc5bad73d6b8
Ruby
ChocolateAceCream/codewar
/prime.rb
UTF-8
472
4.125
4
[]
no_license
=begin Is Prime Define a function isPrime that takes one integer argument and returns true or false depending on if the integer is a prime. Per Wikipedia, a prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. =end def find_prim(num) return false...
true
957c7a1faa03553b490e35a73bc81b646d58dd61
Ruby
hchoroomi/rapi_doc
/spec/method_doc_spec.rb
UTF-8
3,160
2.609375
3
[ "MIT" ]
permissive
require 'spec_helper' describe RapiDoc::MethodDoc do before do @method_doc = RapiDoc::MethodDoc.new('a_type') end describe "#methods" do describe 'add_variable' do before do @name = 'any_name' @value = 'a_value' end it "should add a new attribute to the object with the...
true
cf7797bfa701428e5810a509d1c85549712308fb
Ruby
toucan-stan/Intro-to-Programming-Companion-Workbook
/Int_Quiz_3/int_3.3.rb
UTF-8
1,574
4.34375
4
[]
no_license
#Tealeaf Introduction to Programming, Companion Workbook #Intermediate Quiz 3, Question 3 #Let's call a method, and pass both a string and an array as parameters and see #how even though they are treated in the same way by Ruby, the results can be different. #Study the following code and state what will be printed....
true
a854e19aae0a857ff87980f5b82db64ad65424a9
Ruby
svamja/project_euler
/p082-path-sum-three-ways.rb
UTF-8
2,260
3.65625
4
[]
no_license
# PROBLEM STATEMENT # The minimal path sum in the 5 by 5 matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is indicated in red and bold; the sum is equal to 994. # ⎛⎝⎜⎜⎜⎜⎜⎜1312016305378056739680369973223434274649752410396542212...
true
ac59d5f20f48fede1d6f84f601e2c59a62d2c9cd
Ruby
lausan029/E7CP2A1
/ej2.rb
UTF-8
749
4.09375
4
[]
no_license
# # #Extraer todos los elementos que excedan mas de 5 caracteres utilizando el método .select. nombres = ["Violeta", "Andino", "Clemente", "Javiera", "Paula", "Pia", "Ray"] p nombres.select{ |nom| nom.length > 5 } #Utilizando .map crear una arreglo con los nombres en minúscula. arr_minus = nombres.map { |e| e.downcas...
true
4072c397aec140ab45d59713757568aa0f632d47
Ruby
lazyrain/zipdf
/zipdf.rb
SHIFT_JIS
2,118
2.625
3
[]
no_license
#! ruby -Ks require 'rubygems' require 'zip/zipfilesystem' require 'prawn' require 'fileutils' OUTPUT_PATH = ".\\temp\\" if ARGV[0].nil? print "t@Cw肳Ă܂...\n\n" exit(-1) end if File.extname(ARGV[0]) != ".zip" print "zipt@Cw肵Ă...\n\n" exit(-1) end print "zipdf s܂...\n\n" # w肵tH_...
true
a00bd3e28b1a3a22fafa3cd60e8e9edf874acb8f
Ruby
beetlejuice/dou-votes
/votes_parser.rb
UTF-8
1,421
2.96875
3
[]
no_license
require 'open-uri' require 'nokogiri' VOTES_NUMBER_LOCATOR_CSS = "div#votersWidgetId > div.title > span" VOTER_IMG_LOCATOR_CSS = "div#votersWidgetId > ul > li > a > div > img" QUESTION_BLOCK_LOCATOR_CSS = "div#companyPollResultsId > div.l-question > ul > li" QUESTION_TITLE_LOCATOR_CSS = "div.title" QUESTION_STAT_LOCAT...
true
4e47cd815881b50f4abcf80626039f35e25292b5
Ruby
vaginessa/Jekyll-v3.0.3-Portable
/ruby/lib/ruby/gems/2.1.0/gems/predicated-0.2.6/lib/predicated/simple_templated_predicate.rb
UTF-8
1,894
2.90625
3
[]
no_license
require "predicated/predicate" require "predicated/evaluate" module Predicated def SimpleTemplatedPredicate(&block) result = nil Module.new do extend SimpleTemplatedShorthand result = instance_eval(&block) end result end class And def fill_in(placeholder_replacement) And....
true
5e5f531a5aa36d6e9d4069a613abc8066e7888d5
Ruby
tong-wu/zd_challenge
/spec/tools/search_spec.rb
UTF-8
1,046
2.578125
3
[]
no_license
require "spec_helper" require "./tools/search.rb" describe Search do describe "#search" do let(:stub_db) do [ { "_id": 1, "name": "personOne", "role": "employee", }, { "_id": 2, "name": "personTwo", "role": "admin", }, { "_id": 3, "name": "personThreee...
true
de0f1b59170c8460b1541e7834f1cf99f576af3e
Ruby
allisonharris/ruby_the_hard_way
/ex16.rb
UTF-8
902
3.796875
4
[]
no_license
# getting the file we will use from the command line filename = ARGV.first script = $0 puts "We're going to read #{filename}" puts "If you don't want that, hit CTRL-C (^C)." puts "If you do want that, hit RETURN." print "? " #we give it the CTRL-C or we hit RETURN STDIN.gets puts "Opening the file..." # opening a fil...
true
ca0a251acbb887346c0aff6a5885f8a849cc1c35
Ruby
mehtaculous/sep-assignments
/02-algorithms/06-improving-complexity/improving_complexity_version3.rb
UTF-8
401
3.484375
3
[]
no_license
# Improving Space Complexity def space_complexity(*arrays) arrays.flatten sorted_array = [arrays.delete_at(-1)] for val in arrays length = sorted_array.length length.times do |i| if val <= sorted_array[i] sorted_array.insert(i, val) break elsif i == length - 1 sorted_...
true
6dd2af82407c602473cc44ed13b41f1a4383c79f
Ruby
naorespawn/rubybook
/chapter_11/warikan3.rb
UTF-8
277
4.03125
4
[]
no_license
def warikan(bill, number) warikan = bill / number puts "1人あたりの値段は#{warikan}円です" rescue ZeroDivisionError puts "0人では割り勘できません" end # begin,end節を省略できる warikan(100, 0) warikan(100, 1) warikan(100, 2)
true
33fd2451ddcfa900d5d8cdb0cfc2b030c71df56e
Ruby
brookearyan/array-CRUD-lab-web-082817
/lib/array_crud.rb
UTF-8
604
3.96875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def create_an_empty_array empty_array = [] end def create_an_array cats = ["Fluffy", "Bijou", "Coco", "Stephanie"] end def add_element_to_end_of_array(array, element) array.push(element) end def add_element_to_start_of_array(array, element) array.unshift(element) end def remove_element_from_end_of_array(arr...
true
883d7e929e3ce42444b884dfbb3b32d037a92b49
Ruby
FLWallace105/sports-jacket
/lib/recharge_limit.rb
UTF-8
683
3.3125
3
[]
no_license
#recharge_limit.rb module ReChargeLimits def determine_limits(recharge_header, limit) puts "recharge_header = #{recharge_header}" puts "sleeping 1 second" sleep 1 my_numbers = recharge_header.split("/") my_numerator = my_numbers[0].to_f ...
true
1b24e067c1a9c6c4e1163eb3bf3370e39e97e1ec
Ruby
darrenmwong/Study_Hall
/ClassNoteArray.rb
UTF-8
220
2.546875
3
[]
no_license
Class Notes #looping array then putting it in reverse arr[1,2,3,4,5] count = 0 len = arr.size while count < len arr.push arr.shift count += 1 end Git and Github #manage a file or project over the set of time
true
cd23daafca62a0f75d150b15babd7cde08edda31
Ruby
lhorlacher/manchester_coding_game
/scaffolds/simple.rb
UTF-8
1,781
4.1875
4
[]
no_license
# "Simple" challenge. Each "pulse" from the source is represented by a single # "1" or "0". A pair of pulses is called a "frame", and will represent a binary # "bit". # # If the frame is "01", then the bit is a "0". # If the frame is "10", then the bit it a "1". # # You should never receive a frame that is "00" or "11"...
true
67ffca8eaf4823d3ae37d5801681294fd0b88567
Ruby
Granit/smartset
/app/models/currency.rb
UTF-8
776
2.609375
3
[]
no_license
class Currency < ActiveRecord::Base #has_and_belongs_to_many :countries has_many :monetizations, :dependent => :destroy has_many :countries, :through => :monetizations def initialize(keys={}) super self.collected ||= false end def self.by_name(name) #find(:all, :conditions => ["name = ?", name.to_s]) ...
true
9849c52b339d9928d744e646e344b758cc3e8f2a
Ruby
marcus02219/padrino
/lib/dreamwalk_padrino_api/api_request.rb
UTF-8
2,338
2.71875
3
[ "MIT" ]
permissive
class ApiRequest < Sequel::Model unrestrict_primary_key plugin(:timestamps, update_on_create: true) plugin(:paranoid) many_to_one :api_user_token # # Verifies if an API request is valid based on its HTTP_AUTHORIZATION header. # # @param auth_header = nil [String] HTTP_AUTHORIZATION header to check ...
true
7670afef65bc67d8e16ee4fe01c3f1da1f63a169
Ruby
nabhanelrahman/dotfiles
/.bin/download-archiver
UTF-8
1,916
3.109375
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
#!/usr/bin/env ruby require 'fileutils' require 'digest/md5' class DownloadArchiver attr_reader :files attr_reader :md5_to_files def initialize(dir) @base_dir = dir _scan_for_files _hash_files end def remove_duplicates @md5_to_files.each_value do |v| if v.size > 1 for i in 1...
true
89053eef38de6259ad6c28881bcaf6e20de7db06
Ruby
sugyan/aoj
/volume-21/2131/2131.rb
UTF-8
272
3.03125
3
[]
no_license
def calc(d) loop.with_index do |_, i| next if i == 0 n = (i * Math::PI).to_i n += 1 if Math::PI > (n + 0.5) / i if (Math::PI - 1.0 * n / i).abs < d return "#{n}/#{i}" end end end loop do d = gets.to_f break if d == 0.0 puts calc(d) end
true
a1b90a100043322fed09f955f5b0eb0d8eb4679e
Ruby
Ayat-allahBouramdane/EnergyDataSimulationChallenge
/challenge3/webapp/toshihiro_yokota/app/services/city_chart_service.rb
UTF-8
377
2.75
3
[]
no_license
class CityChartService private_class_method :new def self.call(cities) new.call(cities) end def call(cities) cities.select(:id, :name).map do |city| { name: city.name, data: city.energies .group(:year, :month) .order(:year, :month) ...
true
ad0707a958cf777311895eaa715dcca6801447e1
Ruby
gogolqx/nand2tetris-3
/projects/08/vm_translator/lib/vm/instruction/function.rb
UTF-8
712
2.59375
3
[ "MIT" ]
permissive
module VM module Instruction class Function attr_reader :name, :arity, :context def initialize(line, context) @context = context _, @name, arity = line.split @arity = arity.to_i end def commented_assemblies ["// function #{name} #{arity}"] + to_assemblies ...
true
bfa1998e2a3e44e402d9a6f00a22b14521b349d9
Ruby
dacmanj/financials
/app/models/account.rb
UTF-8
643
2.5625
3
[]
no_license
# == Schema Information # # Table name: accounts # # id :integer not null, primary key # name :string(255) # created_at :datetime not null # updated_at :datetime not null # section_id :integer # side :integer # class Account < ActiveRecord::Base attr_accessible :nam...
true
86c45dbeb7fc0d90092d4253e671e7215334a2ec
Ruby
afurmanov/tagged_logger
/examples/one_tag_per_classes.rb
UTF-8
671
2.796875
3
[ "MIT" ]
permissive
require File.join(File.dirname(__FILE__), '/examples_helper') puts "\n<<<#{File.basename(__FILE__, ".rb")}>>> \n".upcase class LogFoo def foo logger.info("#{self.class}#foo") end end Ftp = Class.new LogFoo Http = Class.new LogFoo Sockets = Class.new LogFoo TaggedLogger.rules do format { |level, tag, messa...
true
0afe491df820ff554b9160981165209ac20aabdf
Ruby
raluka/ruby_colearning_warmup
/warmup-004/warmup-004.rb
UTF-8
53
3.078125
3
[]
no_license
def count_words(answer) answer.split(" ").count end
true
53d9f7aa5b3bf4ebaeb47014450982ed65cfe038
Ruby
tylerpporter/date_night
/test/bst_test.rb
UTF-8
3,812
3.359375
3
[]
no_license
require_relative 'test_helper.rb' require './lib/bst.rb' require './lib/node.rb' class BinarySearchTreeTest < Minitest::Test def setup @tree = BinarySearchTree.new end def test_it_exists assert_instance_of BinarySearchTree, @tree end def test_it_creates_a_root_node @tree.insert(89, "Seven") ...
true
653e3fed452c90562905aac08150044770a93505
Ruby
pickledyamsman/ruby-music-library-cli-v-000
/lib/music_library_controller.rb
UTF-8
1,776
3.390625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class MusicLibraryController def initialize(path = './db/mp3s') MusicImporter.new(path).import end def call input = "" while input.downcase != "exit" puts "What would you like to do?" input = gets.chomp case input when "list songs" list_songs puts "Would you ...
true
4b00c3ca38fcb87efae8eccd267577f5d37f0153
Ruby
Jp1200/ruby-enumerables-introduction-to-map-and-reduce-lab-austin-web-012720
/lib/my_code.rb
UTF-8
1,266
3.4375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# My Code here.... def map_to_negativize(source_array) i = 0 new_array = [] while i < source_array.length do new_array << source_array[i]*(-1) i += 1 end return new_array end def map_to_no_change(source_array) i = 0 new_array = [] while i < source_array.length do new_array << source_ar...
true
5c02f8ac3794d860b3ded5d467cb9c762cec0e87
Ruby
hulloemily/study_playlist
/models/model.rb
UTF-8
2,970
2.546875
3
[]
no_license
#we want this method to take us to the modified subject page based on the original subject chosen def choose_subject(choice) page = {} case choice when "History" page[:picture] = "http://history.appstate.edu/sites/history.appstate.edu/files/images/Map2.jpg" page[:description] = "Helpin' out your history w...
true
81afc06cd629c5b9634b987600a2649b702d89a9
Ruby
mattmalane/ruby_small_problems
/easy_9/grade_book.rb
UTF-8
313
3.453125
3
[]
no_license
def get_grade(num1, num2, num3) average = (num1 + num2 + num3) / 3 case average when 90..100 then 'A' when 80..89 then 'B' when 70..79 then 'C' when 60..69 then 'D' when 0..59 then 'F' else "A+" end end get_grade(95, 90, 93) == "A" get_grade(50, 50, 95) == "D" get_grade(100, 100, 104) == "A+"
true
a75b3f3ae271e702fa379996081aa833e271e444
Ruby
krpk1900/AtCoder
/ABC/ABC180/ABC180_B.rb
UTF-8
509
3.671875
4
[]
no_license
N = gets.chomp.to_i xs = gets.chomp.split.map(&:to_i) def calc_manhattan_distance(xs) manhattan_distance = 0 xs.each do |x| manhattan_distance += x.abs end return manhattan_distance end def calc_euclidean_distance(xs) sum_square = 0 xs.each do |x| sum_square += x**2 end ...
true
71d3fe3dd2b1ba674e074992ccf7f3ed1db46e03
Ruby
tjhubert/phone_rails
/app/models/user.rb
UTF-8
1,744
2.53125
3
[]
no_license
class User < ActiveRecord::Base include VerifyPhoneNumberHelper # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable validates :phone_nu...
true
6b786c5b05a0fcfbf0534dadf65e6d7d7c64e3a8
Ruby
boudejo/lookatrails
/config/initializers/config.rb
UTF-8
8,293
2.609375
3
[]
no_license
# ------------------------------------------------------------------------------------------------------------------------------ # EXTENSIONS # ------------------------------------------------------------------------------------------------------------------------------ # Extends ActiveRecord with: # - default named sc...
true
00aabeed4c8b05fddcc4ca634df772342fe4ea12
Ruby
tadd/steep
/smoke/block/d.rb
UTF-8
526
3.078125
3
[ "MIT" ]
permissive
# @type var a: ^(Integer) -> String a = -> (x) { x.to_s } # @type var b: Array[Float] # !expects IncompatibleAssignment: lhs_type=::Array[::Float], rhs_type=::Array[::String] b = [1,2,3].map(&a) # !expects IncompatibleAssignment: lhs_type=::Array[::Float], rhs_type=::Array[::String] b = [1,2,3].map(&:to_s) # !expec...
true
0f2801ba6c3fc80872db08b52aa098be82d06565
Ruby
patslat/Checkers
/checkers.rb
UTF-8
1,637
3.4375
3
[]
no_license
require 'colorize' require 'yaml' require './HumanPlayer.rb' require './Board.rb' require './Piece.rb' class InvalidMoveError < StandardError end class Checkers def initialize @board = Board.new @players = { :black => HumanPlayer.new(:black), :red => HumanPlayer.new(:red) } @turn = :blac...
true
2285ef69f589e7a9ade741755b6fafe0f5032f3d
Ruby
blake-enyart/battleship_explosion
/test/cell_test.rb
UTF-8
2,354
3.171875
3
[]
no_license
require './lib/ship' require './lib/cell' require 'minitest/autorun' require 'minitest/pride' require 'pry' class CellTest < Minitest::Test def setup @cell = Cell.new("B4") @nina = Ship.new("Cruiser", 3) @cell_1 = Cell.new("B1") @cell_2 = Cell.new("C3") end def test_cell_exist assert_inst...
true
474c75f9bf6c7c522bc4c306d694280073d79a6c
Ruby
mattlqx/pre-commit-search-and-replace
/lib/search-and-replace.rb
UTF-8
3,760
3.03125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'tempfile' # A set of files represented as a collection that can each be parsed for a search string or regexp and optionally, # atomically move a string-replaced version of the file in place. class SearchAndReplace attr_reader :search attr_reader :replacement def initializ...
true
7841d1269c89aaf107ee3ab8784810ce7a3570ec
Ruby
brycemooore/duckat
/app/models/user.rb
UTF-8
1,540
2.71875
3
[]
no_license
class User < ApplicationRecord has_many :items, foreign_key: 'seller_id', class_name: 'Item' has_many :bids, foreign_key: 'user_id' has_many :bidded_items, through: :bids, source: :item has_many :comments has_many :comment_items, through: :comments, source: :item # before_create :default_value...
true
33f5795c558d4bd5d9dcc8aae00716a85cbc653a
Ruby
pghalliday/yard-cucumber
/lib/cucumber/city_builder.rb
UTF-8
13,036
2.96875
3
[ "MIT" ]
permissive
module Cucumber module Parser class CityBuilder include Gherkin::Rubify # # The Gherkin Parser is going to call the various methods within this # class as it finds items. This is similar to how Cucumber generates # it's Abstract Syntax Tree (AST). Here instead this generates the ...
true
931bb68be216dc511547ebd028bdfc97ae6dc965
Ruby
nickrw/rajax
/controller/main.rb
UTF-8
1,659
2.53125
3
[]
no_license
class MainController < Controller def index @title = "Rajax test pad" %{ <p>Rajax is a work-in-progess Ramaze ajax helper, it is ORM agnostic (in fact, you don't even need to be using a database in order to take advantage of it)</p> <p>Rajax can do the following:</p> <hr /> <h3>Edit th...
true
1b85bdb653f6da9b1321785291c346dffa2dbb68
Ruby
christopherslee/intro_to_dsls
/lib/part_3/monthly_score.rb
UTF-8
832
3.484375
3
[]
no_license
class MonthlyScore attr_reader :paid_balances def initialize(accounts) # keep track of which accounts are paid @paid_balances = {} accounts.each do |account| @paid_balances[account.to_sym] = 0 end end # iterate over all the paid balances and calculate the monthly score def calculate_s...
true
46bf553010cbfbca97b1259d4a20b4459f023e87
Ruby
onfido/tradesman
/lib/tradesman/parser.rb
UTF-8
870
3.0625
3
[ "MIT" ]
permissive
module Tradesman class Parser attr_reader :class_name, :action_string, :subject_string, :parent_string PARSE_REGEX = /(Create|Update|Delete)(.+)/ PARSE_REGEX_WITH_PARENT = /(Create)([A-Z]+.+)For([A-Z]+.+)/ def initialize(class_name) @class_name = class_name @match = class_name.to_s.match...
true
c9636851746b2ee0147b62543d364bafdb7af635
Ruby
tylermcgraw/launchcode_ruby_book
/hashes/exercise_two.rb
UTF-8
136
2.6875
3
[]
no_license
person = { name: "Tyler", age: 23 } place = { state: "California" } p person.merge(place) p person person.merge!(place) p person
true
ba8a6d9416c0a472cf3595e7013a86642a1d7976
Ruby
amckinnell/advent_of_code_2020
/day_11/puzzle_11_1/main.rb
UTF-8
329
2.765625
3
[]
no_license
require_relative "configure_zeitwerk" seating_system = SeatingSystem.new(File.read("../input_11.txt")) rounds = 0 loop do seating_system.next_round break unless seating_system.changed? rounds += 1 raise "Too many rounds" if 100 < rounds end p "#{seating_system.occupied_seats} occupied_seats after #{rounds}...
true
03239c1c5568a00fd5ce88ccb795736f7f0fbacf
Ruby
kenhufford/aA-projects
/W4D2/chess/king.rb
UTF-8
287
3.078125
3
[]
no_license
require_relative "piece.rb" class King < Piece attr_reader :symbol def initialize(color, board, pos) super @symbol = :K end def move_diffs [ [1,1], [1,-1], [-1,1], [-1,-1], [0,1], [0,-1] [1,0], [-1,0], ] end end
true
01baee124745ba56bdc41228c5e1c5a38ec2d021
Ruby
edhowland/viper
/minitest/test_vfs.rb
UTF-8
1,281
2.546875
3
[ "MIT" ]
permissive
# vfs_tests.rb - tests for VFS require_relative 'test_helper' class VFSTest < MiniTest::Test def setup @vm = VirtualMachine.new @vm.mount '/v', env:@vm.ios, frames:@vm.fs @vroot = @vm.fs[:vroot] end def test_normal_open Hal.chdir File.dirname(__FILE__) Hal.open __FILE__, 'r' end def tes...
true
7be85354492288b536e60b54c4ad71d6b16f6c2f
Ruby
kjkkuk/ruby_trainee
/HumanJobPet/spec/human_spec.rb
UTF-8
582
2.75
3
[]
no_license
# frozen_string_literal: true require 'rspec' require_relative '../lib/human' RSpec.describe Human do let(:job) { double('job') } let(:pet) { double('pet') } let(:human) { described_class.new(job, pet) } describe '#work' do it 'should work and get salary' do allow(job).to receive(:salary) ex...
true
98e36aa008e2b7f9abc6ec16d13b37a0aa28328a
Ruby
jonassode/MyYaml
/MyYaml.rb
UTF-8
947
3.15625
3
[]
no_license
require 'yaml' class MyYamlList # It's a List # Each Entry Is Unique # Sorted Alphabetically Ascending def self.load(file_name) content = [] if File.exist?(file_name+'.yaml') content = YAML::load(File.read(file_name+'.yaml')) end return content end def self.save(object, file_name) ...
true
d79509f5d0481cea2df3b46530b141071f84739c
Ruby
Irwin1985/lets_build_a_simple_interpreter-1
/lib/parser.rb
UTF-8
1,624
3.6875
4
[]
no_license
require_relative 'token.rb' require_relative 'lexer.rb' require_relative 'bin_op.rb' require_relative 'num.rb' require_relative 'interpreter.rb' class Parser def initialize(lexer) @lexer = lexer @current_token = @lexer.get_next_token end def error raise 'Invalid syntax' end def eat(token_type)...
true
d80c24eab8984fb04fe042aab613ef53ebab348f
Ruby
bitjourney/mato
/lib/mato/anchor_builder.rb
UTF-8
1,334
2.5625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'erb' module Mato class AnchorBuilder # assumes use of font-awesome # specify it as "<span aria-hidden=\"true\" class=\"octicon octicon-link\"></span>" if you use octicon DEFAULT_ANCHOR_ICON_ELEMENT = '<i class="fa fa-link"></i>' CSS_CLASS_NAME = "anchor" ...
true
4931ee31805b4f840fc7d8f1f2a0785690c9657b
Ruby
maurcs/geokit-rails
/cardinalize/test/cardinalize_test.rb
UTF-8
1,207
3.203125
3
[ "MIT" ]
permissive
require 'test_helper' class CardinalizeTest < Test::Unit::TestCase # Replace this with your real tests. def test_a_floats_cardinality assert_equal 10.0.cardinalize, "North" assert_equal 310.5.cardinalize, "Northwest" assert_equal 175.2.cardinalize, "South" assert_equal 40.0.cardinalize, "Northeast" asser...
true
e02f2f1d5df433cf147d0d466341d33cf5ec468b
Ruby
Oomori-K/MaruBatsu
/Display.rb
UTF-8
328
3.796875
4
[]
no_license
class Display def output(point) puts(" 0 1 2") for y in 0..4 y.even? ? print(y/2," ") : print(" ") for x in 0..10 print(point[y][x]) end print("\n") end end #手番の表示 def player_turn(turn) turn ? (puts "<Player ○>") : (puts "<Player ×>") end end
true
fa43e41aae9b4829da122af436d5e224ef7ce292
Ruby
darthzippy/blog
/models/post.rb
UTF-8
773
2.875
3
[]
no_license
require "stringex" require "pp" class Post include Model def errors @errors = {} if @title.blank? @errors[:title] = "Title must not be empty." end if !@published_at_raw.blank? && @published_at.blank? @errors[:published_at] = "Published At must be a valid date-time." end ...
true
6492a0e25c8afd74aad180de95eb7bc61a92f3e4
Ruby
chujot/zstudy
/test4.rb
UTF-8
1,014
3.109375
3
[]
no_license
require 'sinatra' get '/test' do if params['c'] == 'd' result = params['a'].to_i + params['b'].to_i elsif params['c'] == 'e' result = params['a'].to_i - params['b'].to_i elsif params['c'] == 'f' result = params['a'].to_i / params['b'].to_i elsif params['c'] == 'g' ...
true
68ff5b0f282d04f15fe9f0728a1b93804632b80b
Ruby
gshalev/edx_courses
/SAAS/HW1/part3.rb
UTF-8
306
3.6875
4
[]
no_license
def combine_anagrams(words) # YOUR CODE HERE my_hash = Hash.new {|hash,key| hash[key] = []} words.each do |w| my_key = w.downcase.chars.sort.join my_hash[my_key].push(w) end my_arr = [] my_hash.values.each do |val| my_arr.push(val) end return my_arr end #combine_anagrams
true
4bd7494cf5021a923eb280a38759700a5429af50
Ruby
kupolak/codewars
/Ruby/7 KYU/Sorted? yes? no? how?.rb
UTF-8
148
3.1875
3
[]
no_license
def is_sorted_and_how(arr) if arr == arr.sort "yes, ascending" elsif arr == arr.sort.reverse "yes, descending" else "no" end end
true
1c0e1fcdab1442bd551a0e1772fa850ad12ae977
Ruby
tlcowling/euler
/ruby/probem89.rb
UTF-8
1,860
3.75
4
[]
no_license
#Problem 89 #=============== =begin The rules for writing Roman numerals allow for many ways of writing each number (see About Roman Numerals...). However, there is always a "best" way of writing a particular number. For example, the following represent all of the legitimate ways of writing the number sixteen: IIII...
true
65c2481d9c9aa8ea7d84dc2448b0a5ea7440abe3
Ruby
rubygems/gemstash
/lib/gemstash/cache.rb
UTF-8
2,816
2.625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require "lru_redux" require "forwardable" module Gemstash # Cache object which knows about what things are cached and what keys to use # for them. Under the hood is either a Memcached client via the dalli gem, or # an in memory client via the lru_redux gem. class Cache EXPIRY...
true
a60ac9f65011ed59cb3f52ac37a75eabcb7a71c1
Ruby
torubylist/ruby_learning
/alg/two_num.rb
UTF-8
560
3.671875
4
[]
no_license
def two_sum(nums,target) len = nums.length (0...len).each do |i| if nums[i] > target then next end num2 = i + 1 (num2...len).each do |j| if nums[j] > target then next end sum = nums[i] + nums[j] if sum == target then index1 = i + 1 index2 = j + ...
true
e0fe34efe424bae5cf09ef08d6eec16a97f30290
Ruby
migcont/1_prueba_ruby
/programa.rb
UTF-8
2,269
3.71875
4
[]
no_license
def create_data_structure(file) array_of_hashes = [] #array nuevo #manejo de archivo file = File.open(file, 'r') data = file.readlines.map(&:chomp) file.close data = data.map { |e| e.split(', ') } # separar los datos data.each do |line| student = { name: line.shift, #asignar los nombres y las v...
true
f9fdeff762eb004c28e9c255632184146190783a
Ruby
marmo002/w9d2assignment1
/exercise1.rb
UTF-8
682
2.796875
3
[]
no_license
require 'httparty' toronto_wards_response = HTTParty.get('https://represent.opennorth.ca/boundaries/toronto-wards/') toronto_wards_jason = JSON.parse(toronto_wards_response.body) @wards = toronto_wards_jason["objects"] @wards.map do |ward| puts ward['name'] # puts "#{ward['name']}" end puts "********************...
true
7361b7fba354224574b6e5fd8bc17559714e5eb0
Ruby
patassetbuilders/oop_2
/lesson_4/OO_exersizes_easy2.rb
UTF-8
3,356
4.1875
4
[]
no_license
require 'pry' class Oracle def predict_the_future "You will " + choice.sample end def choice ["eat a nice lunch", "take a nap soon", "stay at work late"] end end oracle = Oracle.new puts oracle.predict_the_future puts oracle.predict_the_future puts oracle.predict_the_future puts oracle.predict_the_fu...
true
41b4f0aa8ab7bd2c664ab8bb804c77d2729309f6
Ruby
anne-other/multi_class_weekend_homework
/guests.rb
UTF-8
429
3.625
4
[]
no_license
class Guest attr_reader :name, :wallet, :fav_song def initialize(name, wallet, fav_song) @name = name @wallet = wallet @fav_song = fav_song end def pay_fee(room) @wallet -= room.entrance_fee() end def have_fav_song(room) if room.find_song(fav_song()).class == Song return "Whoo!...
true
beb5fdf6aaa163a931af5121f856122137a5339e
Ruby
mericda/sinatra-deploys
/password-gen/guessthenumber.rb
UTF-8
1,476
4.53125
5
[]
no_license
# guess the number v0.1 # version: basics puts "Guess the Number" puts "Ready..." puts "Set." puts "Go!" # The object of the game is to guess the number. # The program will begin by picking a random number between 1 and 10. # use rand # This will be stored in a variable. #store in variable secret = rand 1..9 # = ...
true
02332e516ff836b67c3f166ffc5b3fa1cf411b0d
Ruby
a2ikm/erbc
/lib/erbc/writer.rb
UTF-8
412
2.671875
3
[]
no_license
module Erbc class Writer attr_reader :request def initialize(request) @request = request end def write(result) with_output_io do |io| io.write(result) end end private def with_output_io if output = request.output File.open(output, "w") do |io| ...
true
2016ed33c5a3097618f6e3cfb079a6dde61c97f5
Ruby
mjago/CW
/lib/cw/threads.rb
UTF-8
3,647
2.8125
3
[ "MIT" ]
permissive
# encoding: utf-8 module CW class Threads attr_reader :threads def initialize context, processes Thread.abort_on_exception = true @context = context @processes = processes @threads = [] end def start_threads @processes.collect do |th| @threads << start_thread(...
true
936a20e0c1da6e1704490c9c04523849ecd58ae2
Ruby
NiestrojMateusz/Launch-School-101
/exercises/Easy3/3_count_char.rb
UTF-8
1,737
4.59375
5
[]
no_license
# Counting the Number of Characters # Write a program that will ask a user for an input of a word or multiple words and give back the number of characters. Spaces should not be counted as a character. # input: # Please write word or multiple words: walk # output: # There are 4 characters in "walk". # input: # Plea...
true
b45b21faf7d8bafb879669920a7cb392faf47b1f
Ruby
ShadyLogic/craigscraper
/app/controllers/concerns/scraper.rb
UTF-8
1,817
2.703125
3
[ "MIT" ]
permissive
require 'nokogiri' require 'open-uri' require 'httparty' module Scraper BASE_URL = "http://sfbay.craigslist.org" extend ActiveSupport::Concern def archive_posts(links) posts = [] links.each do |link| p "*"*100 p link p "*"*100 post = Nokogiri::HTML(open(link)) posts << scrape_info(post) end ...
true
af932e60260e41ff10ef2bfa4d238ba9be15866e
Ruby
cjford/nand2tetris
/projects/10/compiler/compiler.rb
UTF-8
750
2.921875
3
[]
no_license
require_relative './tokenizer.rb' require_relative './symbol_table' require_relative './parse_tree' class Compiler def initialize(args) @args = args end def compile input_files.each do |input_file| tokenizer = Tokenizer.new(input_file) parse_tree = ParseTree.new(tokenizer, input_file) ...
true
8cecaa0d804262485030d44c892d77f297a82299
Ruby
lluzak/form_objects
/spec/params_converter_spec.rb
UTF-8
3,397
2.59375
3
[ "MIT" ]
permissive
require 'spec_helper' describe FormObjects::ParamsConverter do let(:event_attributes) { { "0" => { "name" => "Name 0" }, "1" => { "name" => "Name 1" } } } let(:params) { { "events_attributes" => event_attributes } } let(:converted_attributes) { [{"name" => "Name 0"}, {"name" => "Name 1"}] } ...
true
9e9e0ea3416d914f119ac305cf2d5153d4e766da
Ruby
evgeniradev/ruby_data_structures_and_algorithms
/data_structures/kueue.rb
UTF-8
694
3.828125
4
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Kueue def initialize @first = nil @last = nil @length = 0 end attr_reader :length def peek first end def enqueue(value) node = Node.new(value) if last last.next = node else @first = node end @last = node @length += 1 puts 'Node enqueued.' ...
true
aa9af1d681344932f9583c5c4a3a3a261a359aab
Ruby
fabrod/ruby-learning
/input.rb
UTF-8
418
4
4
[]
no_license
print "How old are you? " age = gets.chomp print "How tall are you? " height = gets.chomp print "How much do you weigh? " weight = gets.chomp puts "So, you're #{age} years old, #{height} tall and #{weight} you weight." print "Como te llamas?" name = gets.chomp print "Cuando vas para la Republica Dominicana? " travel ...
true