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
1d10e17f47ac55491c8e6f95bf54e952049728b4
Ruby
iliabylich/my.rb
/vm/frames/sclass_frame.rb
UTF-8
319
2.5625
3
[]
no_license
SClassFrame = FrameClass.new do attr_reader :parent_frame def initialize(parent_frame:, of:) @parent_frame = parent_frame @of = of end def prepare sclass = @of.singleton_class self._self = sclass self.nesting = [*@parent_frame.nesting, sclass] end def pretty_name name end end
true
e45aac8c309829ad4941edd6823b4c39a344a7ad
Ruby
TheKnightsWhoSayNil/Camelot-Chess
/app/models/knight.rb
UTF-8
359
3.15625
3
[]
no_license
# /app/models/knight.rb class Knight < Piece def valid_move?(x, y) super(x, y) move_range = [[1, 2], [1, -2], [2, 1], [2, -1], [-1, 2], [-1, -2], [-2, 1], [-2, -1]] move_coordinates = [] move_range.each do |dx, dy| move_coordinates << [(x_position + dx), (y_position + dy)] end move_co...
true
d5e733de3ee6d57a260e530f5f6b553b44dba2ca
Ruby
iamchrissmith/bon_appetit
/lib/pantry.rb
UTF-8
1,589
3.515625
4
[]
no_license
require 'pry' class Pantry attr_reader :stock, :shopping_list def initialize @stock = {} @shopping_list = {} @cookbook = {} end def stock_check(item_name) stock[item_name] || 0 end def restock(item, quantity) current = stock[item] || 0 stock[item] = current + quantity end def ...
true
1451c5b351da02ce7344f8069fc8bb086d356899
Ruby
guz86/basic_oop
/car.rb
UTF-8
3,883
3.546875
4
[]
no_license
# МЕТОДЫ # => подгружаем файл в irb # load './car.rb' # => команды для управления: создаем объект класса # car = Car.new # => команды для управления: id объекта # car.object_id # => вызов методов # car.start_engine # car.beep # car.stop class Car # команды для указания методов возращающий и передающих значение att...
true
5b7e088ff252e6bc5efe60a1719d3af398930a39
Ruby
blakechambers/inheritable-accessors
/lib/inheritable_accessors/inheritable_set.rb
UTF-8
1,051
2.609375
3
[ "MIT" ]
permissive
require 'set' module InheritableAccessors class InheritableSet attr_accessor :__local_values__ attr_reader :__parent__ extend Forwardable WRITE_METHODS = %w{ << add add? merge } REMOVE_METHODS = %w{ clear delete delete? delete_if keep_if reject! replace select! } READ...
true
0307eddf2cad48d3cd0005070b8fcdefa25b38c9
Ruby
DrewWeth/LeagueCoordinator
/colors.rb
UTF-8
324
2.9375
3
[]
no_license
RED = "16711680" DIV = "3335782" GREEN = "008000" def get_color( n ) return GREEN if n > 5 return RED.to_i.to_s(16) if n < 0 color = (RED.to_i - ( DIV.to_i * n ) ).to_i.to_s(16) check_length(color) end def check_length(color) diff = 6 - color.length if diff > 0 color.prepend("0" * diff) end color ...
true
acf3593e924d1c34832ad842469f5aa70db7871b
Ruby
iagomoreira/matrix_parser
/lib/unziper.rb
UTF-8
371
2.765625
3
[]
no_license
class Unziper INVALID_ENTRIES = %w(__MACOSX .DS_STORE) class << self def get_files(zip_file) unziped_file = Zip::File.open_buffer(zip_file) unziped_file.select{|entry| entry.file? && valid_entry?(entry.name)} end private def valid_entry?(entry_name) INVALID_ENTRIES.none? {|patte...
true
431c9ca50afa128b926497d5114090428e3c20fc
Ruby
heated/good-code
/test.rb
UTF-8
23,496
3.765625
4
[]
no_license
def triangle_number(n) n * (n + 1) / 2 end def sum_array(arr) arr.reduce(&:+) end def prime?(number) number != 1 && !(2...number).any? { |factor| number % factor == 0 } end def primes_under(max) (1...max).select { |number| prime?(number) } end def ordered_word?(word) for i in 1...word.size return fals...
true
953efda327fdfabfe5b38f932b6594fa6e76c78e
Ruby
hugolu/tealeaf_prep_course
/intermediate/quiz1-5.rb
UTF-8
253
3.0625
3
[]
no_license
def factors(number) dividend = number divisors = [] begin if dividend == 0 break end divisors << number / dividend if number % dividend == 0 dividend -= 1 end until dividend == 0 divisors end p factors(120) p factors(0)
true
8959d831f65c2671cd1bf317d5d74a8cb3fde9a9
Ruby
CodingSensei19/countdown-to-midnight-onl01-seng-pt-012120
/countdown.rb
UTF-8
113
2.71875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#write your code here def countdown x = 0 number = -10 for x in 0..number puts "Number is: #{x}" x = x + 1 end
true
61e3e90d8e660c17582b5a80609a7fffe9656561
Ruby
ekosz/tic_tac_toe_limelight
/production/tic_tac_toe/players/cell.rb
UTF-8
582
2.828125
3
[]
no_license
on_mouse_clicked do players = CellPlayersBuilder.new(current_player, cell_location, other_player_value) scene.make_move(players.player_1, players.player_2) end def current_player o_count = count("o") x_count = count("x") return "1" if o_count == x_count "2" end def count(letter) scene.find_by_name("c...
true
a9c0c4cc4f0181ced6cafc25e8c3b54300fded72
Ruby
antl-mark/store_bus_tickets_rough
/buy_tickets.rb
UTF-8
1,597
2.53125
3
[]
no_license
class BuyTickets < Filter include Communication include ValidationInput::Choice def initialize @city = {} @busy_place = [] @data_base = WorkWithDb.new @new_table = CreateTerminalTable.new super end def buy_tickets(column, name) @city[:departure_city] = enter_data("Enter the departure ...
true
1acde1d54b4493b20937b134abf533c25970bfca
Ruby
umairabid/algos
/Ruby/leet_code/338.rb
UTF-8
507
3.828125
4
[]
no_license
# @param {Integer} n # @return {Integer[]} =begin if you start counting in binary nums then for an even number n, the number is same as n/2 except the the most significant bit is shifted to left e.g 2 => 010 and 4 => 100 also odd number m is also same as m-1 except with added least significant bit e.g 2 => 010 4=> 10...
true
831bc5ef2e7b28baf68199fae3e4c8348a473e63
Ruby
dmadouros/vacation_tracker
/lib/dates.rb
UTF-8
175
2.609375
3
[]
no_license
module Dates MONTHS_PER_YEAR = 12 def self.current_date DateTime.current end def self.current_year_end 1.year.since(current_date).beginning_of_year end end
true
3340a1625e01b6d69ae97a3e7e2467585af62b5c
Ruby
javiguajardo/interview-prep
/design_patterns/proxy/account_protection_proxy.rb
UTF-8
479
3.125
3
[]
no_license
require 'etc' class AccountProtectionProxy def initialize(real_account, owner_name) @subject = real_account @owner_name = owner_name end def deposit(amount) check_access @subject.deposit(amount) end def withdraw(amount) check_access @subject.withdraw(amount) end def balance check_access @subj...
true
de01242c3b46b22bc6701e20dde4c1a8262c871b
Ruby
calabash/run_loop
/lib/run_loop/app.rb
UTF-8
12,023
2.90625
3
[ "MIT" ]
permissive
module RunLoop # A class for interacting with .app bundles. class App # @!attribute [r] path # @return [String] The path to the app bundle .app attr_reader :path # Creates a new App instance. # # @note The `app_bundle_path` is expanded during initialization. # # @param [String] app...
true
2e3577ee7a07e08a95a54481b7a7c40e526d43ef
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/word-count/dc300933744e45d58938a98ca968f1ef.rb
UTF-8
963
3.921875
4
[]
no_license
class Phrase def initialize(phrase) @words = get_words_from(phrase) @word_hash = {} end def word_count reset_word_count @words.each { |word| increment_word_count_for(word) } @word_hash end private def get_words_from(phrase) phrase.split(/[^\w]+/).each {|word| word.downcase!} ...
true
f6d1b21bb866e9736051f077f015e0936a6c398d
Ruby
MiltonStanley/GitUpdate
/push.rb
UTF-8
448
2.96875
3
[]
no_license
puts "This program is dangerous. If a branch is checked out," puts "it will overwrite master on the remote repo." puts "Exiting now" Kernel.exit def push *repos = `cd .. && ls`.split "\n" puts "Found #{repos.join(', ')}" repos.each { |repo| system "cd .. && cd #{repo} && git push origin master" } end mode = tr...
true
6e5c221daff67190a33384e960cec1bb4147e6c4
Ruby
nodo/opal
/lib/opal/processor.rb
UTF-8
2,216
2.515625
3
[ "MIT" ]
permissive
require 'sprockets' module Opal # Proccess using Sprockets # # Opal.process('opal-jquery') # => String def self.process asset Environment.new[asset].to_s end # The Processor class is used to make ruby files (with rb or opal extensions) # available to any sprockets based server. Processor will th...
true
c9b3a898cc305b98df217a62870a64c78ccd8198
Ruby
lycam/thrift-sqs-transport
/lib/thrift-sqs-transport.rb
UTF-8
2,528
2.671875
3
[ "MIT" ]
permissive
require 'thrift' require 'fog' module Thrift class SqsServerTransport < BaseServerTransport def initialize(queue_name, aws_key, aws_secret, options = {}) @queue_name, @aws_key, @aws_secret = queue_name, aws_key, aws_secret @options = options end def listen @transport = SqsTransport.new...
true
5ca0c7af3ee77ee0b1a0b1f4f85c0dd2b3161709
Ruby
lrdennison/rice-sandwich
/lib/rice-sandwich/sandwich.rb
UTF-8
6,675
2.671875
3
[]
no_license
module RiceSandwich def self.make &block w = Wrap.new w.instance_exec &block return w end class Wrap attr_accessor :class_name attr_accessor :attributes attr_accessor :methods attr_accessor :system_headers attr_accessor :headers def initialize @attributes = Ar...
true
d4e3280fc867fc0ee1ecad1b4c5fd91ad4d75800
Ruby
mikeotoole/data_structures_and_algorithms_in_ruby
/spec/data_structures/graph_spec.rb
UTF-8
915
3.09375
3
[ "MIT" ]
permissive
require 'minitest/autorun' require './data_structures/graph' describe Graph do # 1 2 6 # / \ / \ # 3 - 4 - 5 7 let(:nodes) do { 1 => [3, 4], 2 => [4], 3 => [1, 4], 4 => [1, 2, 3, 5], 5 => [4], 6 => [7], 7 => [6] } end let(:graph) { Graph.new(...
true
5b5b62b4bf960fad0ef12b20bd38e274dd77c433
Ruby
kieran-lockyer/ruby-tdd-and-error-handling-kieran-lockyer
/errors/divide.rb
UTF-8
1,254
4.46875
4
[]
no_license
# This is a simple divider. # Imagine the user tries to divide by zero # Ruby will rightfully freak out and crash with a ZeroDivisionError # Let's bring in some error handling to display a nice message. # class String def is_i? /\A[-+]?\d+\z/ === self end end class NonNumericArgumentError < StandardErr...
true
7a556d93f59740246c4a12afeb4e23847f9c9b3e
Ruby
test-prof/test-prof
/lib/test_prof/factory_prof/printers/simple.rb
UTF-8
1,563
2.515625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require "test_prof/ext/float_duration" module TestProf::FactoryProf module Printers module Simple # :nodoc: all class << self using TestProf::FloatDuration include TestProf::Logging def dump(result, start_time:) return log(:info, "No factori...
true
e2e2c956b1cd0bfd137083d235c02b4b52bebbad
Ruby
noobjey/turing-homework
/file_io/fibber.rb
UTF-8
226
3.328125
3
[]
no_license
class Fibber def self.generate(quantity) if (quantity.is_a? String) || (quantity < 1) 0 elsif quantity < 3 1 else Fibber.generate(quantity - 1) + Fibber.generate(quantity - 2) end end end
true
6e81f710bb2be21c9b3c7cea9799ac2cf3023df7
Ruby
learn-co-students/houston-se-060120
/05-inheritance/models/dog.rb
UTF-8
238
3.640625
4
[]
no_license
# Child (inherits all data and behavior) class Dog < Animal attr_accessor(:sound, :name) def initialize(options) self.sound = "Woof" self.name = options[:name] end def bark puts @sound end end
true
406469d1bff6ae770e421387a032a799b91a6cbc
Ruby
airy-beam/project_euler
/problem48.rb
UTF-8
268
3.859375
4
[]
no_license
#Problem 48 # #The series, 1 ^ 1 + 2 ^ 2 + 3 ^ 3 + ... + 10 ^ 10 = 10405071317. # #Find the last ten digits of the series, #1 ^ 1 + 2 ^ 2 + 3 ^ 3 + ... + 1000 ^ 1000. sum = 0 1.upto(1000) do |n| sum += n**n end print sum.to_s[sum.to_s.length-10, 10]
true
b0c5aeb6c80fd2bb888cea4acc04a0c5e9633339
Ruby
Anaisiananann/S2J2_Exo-Ruby
/brouillon/exo_08.rb
UTF-8
310
3.796875
4
[]
no_license
#Écris un programme exo_08.rb qui demande un nombre à l'utilisateur, puis qui affiche un compte à rebours à partir de ce nombre, jusqu'à 0. puts "Bonjour, vous êtes combien?" print ">" number_user = gets.chomp.to_i while number_user > - 1 do puts number_user number_user -= 1 end
true
a78f145c9cdbf223c8a258c7bb8f1470f61b9213
Ruby
aitorlb/launch_school
/RB109/interview/exercises/medium_1/6_stack_machine_interpretation.rb
UTF-8
6,173
4.21875
4
[ "MIT" ]
permissive
require 'pry' =begin Stack Machine Interpretation A stack is a list of values that grows and shrinks dynamically. In ruby, a stack is easily implemented as an Array that just uses the #push and #pop methods. A stack-and-register programming language is a language that uses a stack of values. Each operation in the...
true
651f1271a80a3fbeb9fb4a8b80b7d74fc6f42e1f
Ruby
IgorDmitriev/ruby_super_8
/load.rb
UTF-8
172
2.625
3
[]
no_license
require_relative 'lib/game' require 'byebug' p1 = Player.new("Bob") p2 = Player.new("Scott") p3 = Player.new("John") game = Game.new([p1, p2, p3]) game.play_super_eight
true
ca9b00bc34e7817cb9aaaca2bc0a7af4cb61fdec
Ruby
AlexRevin/inbank
/app/clients/fixer_io.rb
UTF-8
1,455
2.625
3
[]
no_license
# frozen_string_literal: true class FixerIo include HTTParty base_uri 'api.fixer.io' attr_accessor :from, :to attr_accessor :base_currency def initialize(base: nil, from: Date.yesterday, to: Date.today) @from = from @to = to @base_currency = if base.present? Currency.by_c...
true
361e714ff37ad483ba0b0a6f2ca6b7a67d20f280
Ruby
NathanHynes/student-directory
/Exercises/directory5.rb
UTF-8
1,618
4.40625
4
[]
no_license
def input_students puts "Please enter the names of the students" puts "To finish, just hit return twice" # Create an empty array students = [] # Get the first name name = gets.chomp # While the name is not empty, repeat this code while !name.empty? do # Add the student hash to the array students...
true
f87909a665a370049b5b7870ab93147f6371179d
Ruby
pvhiep96/zinza_trainning
/app/models/order_detail.rb
UTF-8
555
2.53125
3
[]
no_license
class OrderDetail < ApplicationRecord belongs_to :order belongs_to :product validates :quantity, numericality: { only_integer: true, greater_than_or_equal_to: 1 }, presence: true validates :price, presence: true delegate :user, to: :product def self.to_csv attributes = %w[name quantity price seller_nam...
true
d86a2f5d84ce888d351556c65939e8dba829abd5
Ruby
djeusette/codility
/toptal/1.rb
UTF-8
483
3.171875
3
[]
no_license
def solution(x, a) total_diff = 0 for index in [*0..a.length-1] if a[index] != x total_diff += 1 end end equ = 0 diff = 0 for index in [*0..a.length-1] if a[index] == x equ += 1 else diff += 1 end if equ == total_diff - diff return index + 1 if index < a.l...
true
97f9e59d6e8d814c3e6916ee24b0519f6d54a1a1
Ruby
cjbrock/object-relationships-081720
/ticket.rb
UTF-8
418
2.921875
3
[]
no_license
class Ticket @@all = [] attr_accessor :seat_number, :destination, :airline, :passenger def initialize(seat_number, destination, airline) @seat_number = seat_number @destination = destination @airline = airline @@all << self end # def passenger=(pass) # @pas...
true
8c717271154c75b14aeacbe9d46b28001659b392
Ruby
suryart/ruby_concepts
/problems/mars_rover/lib/mars_rover/rover.rb
UTF-8
1,404
3.890625
4
[]
no_license
# Author: Surya Tripathi 19/11/2013 12:18 AM # Rover class represent a rover on a plateau which has a direction and a current position as x and y co-ordinates module MarsRover class Rover attr_reader :direction, :position, :max_position def initialize(initial_direction, max_position, current_position=[0,0]) ...
true
c16111801f0db2528e86512b4f21446b3f204686
Ruby
argent-smith/rsh
/lib/rsh.rb
UTF-8
5,670
3.09375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# -*- Ruby -*- # Ruby remote shell protocol (RFC 1282) client. # Development thing $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'socket' # we'll need it in pure ruby implementation # = Ruby remote shell protocol (RFC 1282) client # # Creates and operates an rsh client instance. Parameters may # be specified th...
true
37a2f51950cd2b231fe4d96f983ff206aaac0a8a
Ruby
Nur-Alam39/ruby-syntax
/Module/use_module_method_by_class.rb
UTF-8
323
3.5
4
[]
no_license
module Profile def name puts 'Module method - Name' end def address puts 'Module method - Address' end def age puts 'Module method - age' end end class Person include Profile def location puts 'Instance method- Location' end end obj = Person.new obj.name obj.address obj.age obj.locat...
true
7fa8f27e9e7534a961e529a867e2aa8d062047c8
Ruby
baalberith/course-ruby
/server.rb
UTF-8
1,026
2.578125
3
[]
no_license
#!/usr/bin/env ruby require 'yaml' require 'drb' require 'dbm' # zadanie 1 class Logger def initialize(file = 'logger.dbm') if File.exist?(file) @db = DBM.open(file) else @db = DBM.new(file) end end def save(prg_id, msg) logs = YAML.load( @db[prg_id.to_s] ) logs[Time.new] = ...
true
8fe5efe31d237b1f359f44a21a0d175f773f73bd
Ruby
Michael-Gr/CodeKatas
/Fizz_buzz_cuckoo_clock.rb
UTF-8
3,223
3.90625
4
[]
no_license
################# # Link to kata: # ################# # # https://www.codewars.com/kata/58485a43d750d23bad0000e6 # ################ # Description: # ################ # # Your story # # You've always loved both Fizz Buzz katas and cuckoo clocks, and when you walked by a garage sale and saw an ornate cuckoo clock with a ...
true
9146ce3ee57314b07e45a0459f3ef208e4f3007d
Ruby
christian-schulze/pong
/lib/pong/player.rb
UTF-8
629
3.015625
3
[ "MIT" ]
permissive
module Pong class Player STEP_SIZE = 10 attr_reader :x, :y, :width def initialize(target:, x:, y:, width:) @target = target @x = x @y = y @width = width end def move_left @x += -STEP_SIZE if @x >= 0 end def move_right @x += STEP_SIZE if @x...
true
796222a799351de4fce74ec2f7ccd06018d99afa
Ruby
KSriki/ruby-collaborating-objects-lab-dc-web-082718
/lib/song.rb
UTF-8
343
2.953125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_accessor :name, :artist def initialize(name) @name = name end def self.new_by_filename(filename) song = self.new(filename.split(" - ")[1]) arts = Artist.find_or_create_by_name(filename.split(" - ")[0]) song.artist = arts arts.add_song(song) ...
true
cadaf849ee9f56491df055f86ca69ecd29ab7ae1
Ruby
laurenand/Travelr
/lib/countries/api.rb
UTF-8
898
3.484375
3
[ "MIT" ]
permissive
require 'pry' class API #extracts data from API and determines if the country is valid def self.valid_country?(capital_city) url = "https://restcountries.eu/rest/v2/capital/#{capital_city}" response = HTTParty.get(url, follow_redirects: true) # sends request for data to url if response.ok? ...
true
25a2f52eb6c7d89682db3b3c4f2a5a5243ac7752
Ruby
joeymariano/ttt-with-ai-project-v-000
/lib/game.rb
UTF-8
2,008
4.15625
4
[]
no_license
class Game attr_accessor :board, :player_1, :player_2 WIN_COMBINATIONS = [ #horizontal [0,1,2], [3,4,5], [6,7,8], #vertical [0,3,6], [1,4,7], [2,5,8], #diagonal [0,4,8], [2,4,6] ] def initialize(player_1 = Players::Human.new("X"), player_2 = Players::Human.new("O"),...
true
16893506154b85f56619370a9eca8e1bc95572cb
Ruby
hkulekci/treehouse-ruby-notes
/11-Modules/extend.rb
UTF-8
261
3.8125
4
[]
no_license
# Extend makes methods available to the class class Hello def initialize(name) @name = name end end module SayHello def say_hello puts "Hello #{@name}" end end hello = Hello.new("Jason") hello.extend SayHello hello.say_hello
true
67d3d53196a74107a604951f25524d07312e41c2
Ruby
kill4fun195/RobustTechHouseTest
/spec/support/api_helpers.rb
UTF-8
381
2.578125
3
[]
no_license
module Helpers def api_header(access_token = nil) ret = { 'X-App-Token': '46df850800c68f98da9efc625bbdcd7f' } ret.merge!({'X-Access-Token': access_token}) if access_token ret end def get_with_header(url, access_token = nil) get(url, nil, api_header(access_token)) end def post_with_header(url...
true
179037f442b34f334ffa5f637a96720dc42cb54d
Ruby
AfifZuhair08/Ruby-Snippets
/giraffe.rb
UTF-8
140
3.265625
3
[]
no_license
# printing strings print "My name is Afif" # print in new line puts "Age: 26 " # shape puts " /|" puts " / |" puts " / |" puts "/___|"
true
41d46cc1468ff54a6028fb152f55a97a7a59d44b
Ruby
SocialCentivPublic/yt-core
/lib/yt/group.rb
UTF-8
953
2.5625
3
[ "MIT" ]
permissive
module Yt # Provides methods to interact with YouTube Analytics groups. # @see https://developers.google.com/youtube/analytics/v1/reference/groups class Group < Resource # @!attribute [r] title # @return [String] the group’s title. has_attribute :title, in: :snippet # @!attribute [r] published_at...
true
f0e5cc4e31e78a2db9b08df6fe93c93119b6c302
Ruby
waihon/tealeaf_ruby
/files/delete_file.rb
UTF-8
433
2.890625
3
[]
no_license
def file_exist(filename) #file = File.open(filename, "r") #unless file.nil? if File.exists?(filename) puts "#{filename} exists" else puts "#{filename} does not exist" end #file.close end FILENAME1 = "dummy_file1.txt" FILENAME2 = "dummy_file2.txt" File.new(FILENAME1, "w+") file_exist(FILENAME1) Fi...
true
c2b27b48f9d70b6a720bcde0c235e8aa93d5262e
Ruby
heuperman/oystercard_thursday
/spec/station_spec.rb
UTF-8
331
2.71875
3
[]
no_license
require 'station' describe Station do let(:station) { Station.new('Oxford St', 'zone_1') } describe 'return what zone a station is in' do it 'knows what it is name is' do expect(station.name).to eq 'Oxford St' end it 'knows what zone it is in' do expect(station.zone).to eq 'zone_1' end...
true
8be4c2a05f33d413e6505141d0384e24770cd756
Ruby
kanha55/sales-taxes
/app/helpers/input_csv_helper.rb
UTF-8
598
2.953125
3
[]
no_license
module InputCsvHelper include CsvHelper def read_input receipt = Receipt.new # Read csv file and remove header row data_rows = read_file(input_file) data_rows.shift data_rows.each do |item| next if item.empty? || item.length != 3 || item.map(&:strip).any?(&:empty?) next unless Num...
true
53a22b4c67f8b505a59978b2435c35b36c619b13
Ruby
svyatov/sec_id
/lib/sec_id/isin.rb
UTF-8
1,176
3.15625
3
[ "MIT" ]
permissive
# frozen_string_literal: true module SecId # https://en.wikipedia.org/wiki/International_Securities_Identification_Number class ISIN < Base ID_REGEX = /\A (?<identifier> (?<country_code>[A-Z]{2}) (?<nsin>[A-Z0-9]{9})) (?<check_digit>\d)? \z/x.freeze attr_reader :country_cod...
true
a5997d782e4b6457fe2ff4b7d7861878f0865884
Ruby
jkopczyn/AdventOfCode
/2015/day24.rb
UTF-8
3,071
3.4375
3
[]
no_license
require 'byebug' require 'set' def pack_sleigh(filename) presents = [] File.open(filename, 'r') do |file| file.each do |line| presents << line.strip.to_i end end p presents.sort! target_weight = presents.inject(&:+) / 3 shortest_possible = [] while shortest_possible.inject(0, &:+) < target_...
true
66a3d0ddb6515d5ed10a8dfe3f85acdc86e73e83
Ruby
BDCraven/learn-to-program
/chap05/ex1.rb
UTF-8
407
3.609375
4
[]
no_license
puts "Hi, please can you tell me your first name?" first_name = gets.capitalize.chomp puts "And what is your middle name?" middle_name = gets.capitalize.chomp puts "And finally, please can I have your last name?" last_name = gets.capitalize.chomp if middle_name.empty? puts "Pleased to meet you #{first_name} #{last_n...
true
19e0742d1c5e35f91c6717005974bd82d5d39ed4
Ruby
yang70/tic-tac-toe-api
/app/models/concerns/check_winner.rb
UTF-8
854
3.125
3
[]
no_license
module CheckWinner include WinningIndices def check_winning_indices( board, turn ) if board[ 1 ][ 1 ] == turn game_won = check_index_groups( board, turn, :center ) return game_won if game_won end check_index_groups( board, turn, :rows_and_columns ) end private def ...
true
b7d9572a7637e3344ee40f2bff4b060fc6902c82
Ruby
Louvivien/Beerly
/app/services/beers_feeder.rb
UTF-8
1,549
2.75
3
[]
no_license
# frozen_string_literal: true require 'httparty' require 'csv' require 'nokogiri' require 'open-uri' class BeersFeeder def initialize @key = Beerly::Application.credentials.brewery_db @search_url = 'https://www.brewerydb.com/search?q=' end def scrap_beers beers = [] file = File.open('db/beer.tx...
true
da68eff99e1ba376efded07a1b9adbea1888ef38
Ruby
Global19-atlassian-net/diors-cloud
/server/app/models/project.rb
UTF-8
1,402
2.59375
3
[]
no_license
require 'fileutils' require 'securerandom' require 'pathname' class Project < ActiveRecord::Base attr_accessible :name, :slug, :token validates_presence_of :name, :owner_id validates_format_of :name, with: /\w+/ validates_uniqueness_of :name has_one :machine belongs_to :owner, class_name: 'User' has_an...
true
1e7a786803c2a49220a0f52b9ddce309c6d16dd0
Ruby
dominicfraser/LearnRubytheHardWay
/ex36.rb
UTF-8
444
3.90625
4
[]
no_license
def gold_room puts "This room is full of gold. How much do you take?" print "> " choice = $stdin.gets.chomp while choice.to_i.to_s != choice do puts "That wasn't a number, try again." choice = $stdin.gets.chomp end how_much = choice.to_i if how_much < 50 puts "Nice, you're not greedy, you win!" ...
true
dd83d4fe735753f9735f0d52624fbc1847efcaa8
Ruby
take-cheeze/mruby-msgpack
/specs/tool.rb
UTF-8
465
2.828125
3
[]
no_license
def hex_string(s) if s.respond_to?(:bytes) s.bytes.map{|c| format('%02x', c) } else s end end def assert_equal(expected, given) if expected != given raise "Expected #{hex_string(expected)}, got #{hex_string(given)}" end end def header(str) puts "\n#{str}:" end def should(msg) spaces = 50 ...
true
fef9608ef07955eeb3b6d21698de7066d8cc3357
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/cs169/combine_anagrams_latest/12223.rb
UTF-8
501
3.640625
4
[]
no_license
input = ['cars', 'for', 'potatoes', 'racs', 'four','scar', 'creams', 'scream'] # output:["creams", "scream"]] # HINT: you can quickly tell if two words are anagrams by sorting their # letters, keeping in mind that upper vs lowercase doesn't matter def combine_anagrams(words) anagrams = words.inject(Hash.ne...
true
4b661809c4055c04fff0e315386a2e406f46c85c
Ruby
Mfbeeck/Server_repo
/server.rb
UTF-8
235
2.609375
3
[]
no_license
require 'sinatra' #this alone creates a web server #in command line it will give a port number, this is what you put in the web address...localhost:"portnumber" get '/' do "Hello world" end get "/sinatra" do "Hello Sinatra" end
true
228a2fb2be09c484356268e778449d9f5b9ed4b4
Ruby
nyarly/roadforest
/lib/roadforest/resource/parent-item.rb
UTF-8
747
2.65625
3
[]
no_license
require 'roadforest/resource/read-only' require 'roadforest/resource/role/writable' require 'roadforest/resource/role/has-children' module RoadForest module Resource module RDF #Used for a resource that has properties itself that can be updated, and #also has one or more kinds of dependent or subordinate ...
true
c9bfb00c17880e688ac1a8f4d21c7831a46383dc
Ruby
bdisney/tninknetica_basic_course
/les_09/controllers/controller.rb
UTF-8
8,577
3.21875
3
[ "MIT" ]
permissive
class Controller MAIN_ACTIONS = { '1' => { method: :create_station, repeat: true }, '2' => { method: :create_route }, '3' => { method: :edit_route }, '4' => { method: :create_train, repeat: true }, '5' => { method: :move_train }, '6' => { method: :add_carriage }, '7' => { method: :r...
true
7dee0d531c2ebe4d0fbbab7732d8ae5c63501862
Ruby
sarumathiap/hall_booking
/app/models/reminder.rb
UTF-8
531
2.5625
3
[]
no_license
class Reminder < ApplicationRecord acts_as_birthday :dob validates_presence_of :name, :dob validate :user_must_have_been_born #def birthday_today? #dob.month == Time.now.month && dob.day == Time.now.day #end def next_birthday Time.now.to_date.distance_to(self.dob) end def is_birthday? ...
true
37ce81e893db48f222f7b30b68792174a1f9918d
Ruby
apotheon/webri
/work/reference/heirarchy.rb
UTF-8
5,023
2.765625
3
[ "BSD-2-Clause-Views", "BSD-2-Clause" ]
permissive
module RDazzle module Heirarchable # def self.entry_to_path(entry) path = entry.to_s path = path.gsub('::', '/') path = path.gsub('#' , '/i-') path = path.gsub('.' , '/c-') path = OpEsc.escape(path) path = path + '.html' end # def self.path_to_entry(path) ...
true
ef67314756c088471a204dd3d0b6ec3687611a69
Ruby
Wallsays/LearnRuby
/6/conditions.rb
UTF-8
134
2.9375
3
[]
no_license
name = "John" if name == "James" && 2 > 1 puts "My name is Bond" end unless name == "James" && 2 > 1 puts "My name is Bond" end
true
b675cfa7e1fe639c59026f34b183f1ea083dbecd
Ruby
alecho/hangman-1
/hangman.rb
UTF-8
3,507
3.96875
4
[]
no_license
require 'yaml' class Hangman attr_accessor :word, :answer, :guess, :result_array, :guesses_remaining, :word_array def initialize @guesses_remaining = 10 @guess = '' #Intro text puts "Alright, this is a hangman game. Guess letters to fill in the blanks. You have 10 guesses to start." end # load d...
true
47f3c110cba91b07ea43d11199f67635dac9c485
Ruby
phoet/on_ruby
/app/lib/preview_generator.rb
UTF-8
745
2.59375
3
[]
no_license
# frozen_string_literal: true class PreviewGenerator attr_accessor :uri, :type, :code def initialize(uri) @uri = uri end def generate_preview website = LinkThumbnailer.generate(uri) video = website.videos.find { |v| v.embed_code.present? } if video self.code = video.embed_code se...
true
0fd20cc9136c61b12f9313285f88a42bfcaf2078
Ruby
k2works/etude_for_rails
/spec/domains/design_pattern/strategy/report_spec.rb
UTF-8
1,292
2.71875
3
[]
no_license
require 'rails_helper' describe DesignPattern::Strategy::Report do describe '#output_report' do context 'format is HTML' do it 'output' do HTML_FORMATTER = lambda do |context| puts('<html>') puts(' <head>') puts(" <title>#{context.title}</title>") puts(' ...
true
28f4e1d1f9ab92baf16b61b03586fb64778999cb
Ruby
Maihj/anomaly_detection
/detect/detect_cl.rb
UTF-8
2,416
3.1875
3
[]
no_license
require 'anomaly_hmm' $username = `whoami`.chomp $filename = 'commands.txt' $unique_seq, $observation_seq = [], [] #read .bash_history def read_commands newfile = File.new("/home/#{$username}/#{$filename}", "w") File.foreach "/home/#{$username}/.bash_history" do |line| if (i = line.index(" ")) != nil if line[...
true
ebc218d7bccb2313b535698c12c8e18e5e289437
Ruby
DanikaButterfield/ruby-enumerables-introduction-to-map-and-reduce-lab-denver-web-82619
/lib/my_code.rb
UTF-8
1,362
3.625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# My Code here.... def map_to_negativize(source_array) count = 0 new_array = [] while source_array[count] do new_array[count] = source_array[count] * -1 count += 1 end return new_array end def map_to_no_change(source_array) count = 0 new_array = [] while source_array[count] do new_array[count] =...
true
43269a1297f4f4f8818a252f750db84dea01190c
Ruby
mhanberg/Lunch
/app/models/meal.rb
UTF-8
902
2.640625
3
[]
no_license
class Meal < ApplicationRecord belongs_to :group has_many :ratings enum category: { Breakfast: 1, Lunch: 2, Dinner: 3 } def category=(val) write_attribute :category, val.to_i end def self.convert_to_calendar_json(meals, user_id) meals_json = [] meals.each do |meal| meal = meal.as_json ...
true
08bf7927214404853a155747001b39a3d2d411af
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/word-count/b20dcbc5af464087901f2666e94a1f69.rb
UTF-8
247
3.4375
3
[]
no_license
class Phrase def initialize(phrase) @phrase = phrase end def word_count get_words(@phrase).each_with_object(Hash.new(0)) { |i, c| c[i] += 1 if i } end private def get_words(phrase) phrase.downcase.scan(/\w+/) end end
true
6302e669d7fb989e04c8b48661a3f884a37e2e8b
Ruby
BeckyLJH/Ruby
/Rosalind/05_rosalind.rb
UTF-8
467
3.109375
3
[]
no_license
#!usr/bin/env ruby #coding:utf-8 usage = "#{$0} Solve the problem \"Mortal Fibonacci Rabbits\" in Rosalind Author:Jiahui Liu<beckyljh@gmail.com>" # file = "rosalind_rna.txt" def count(n,m) little = [1,0] big = [0,1] for j in 3..m lnum = big[j-2] bnum = big[j-2]+little[j-2] little << lnum big << bnum end ...
true
2d4e9176049d4ac3c3143572c83f91a6819c936f
Ruby
chrishunt/euler
/025-1000-digit-fib/spec/fib_spec.rb
UTF-8
439
3.15625
3
[]
no_license
require 'fib' describe Fib do describe '#take' do it 'takes the first n fibs' do subject.take(5).should == [1, 1, 2, 3, 5] end end describe '#containing_digits' do it 'returns the index of the first fib with 3 digits' do subject.containing_digits(3).should == 12 end it 'returns ...
true
66dca548d69485b665e1e484abf9ac62f7f6625e
Ruby
NiumXp/Algoritmos-e-Estruturas-de-Dados
/src/ruby/Hanoi.rb
UTF-8
346
3.6875
4
[ "MIT" ]
permissive
def Hanoi(pin0, pin2, pin1, num) if num == 1 # Show the operations print "Move from ", pin0, " to ", pin2, "\n" else Hanoi(pin0, pin1, pin2, num-1) Hanoi(pin0, pin2, pin1, 1) Hanoi(pin1, pin2, pin0, num-1) end end # Move from Pin-0 to Pin-2 using Pin-1 as helper (number of di...
true
93cfadc977e13dd51ef66957d366f13255a4b398
Ruby
alina-gutsul/ChangeProject
/app/models/store.rb
UTF-8
505
2.578125
3
[]
no_license
class Store < ActiveRecord::Base def self.get_by_params(params) if !params[:country].nil? && params[:country] != "" products= Country.find(params[:country]).products else products=Product.all end if !params[:cathegory].nil? && params[:cathegory]!="" products= products.where(:group => params[:cath...
true
c482d5a5835a5ab9a904899ceb715b042fc8ad4d
Ruby
naguramasashi/ruby_project
/task1.rb
UTF-8
255
3.28125
3
[]
no_license
n=3 if n==3 puts "nは3です" end if n==3 || n==4 puts "nは3か4のどちらかです" end if n==3 puts "nは3です" else n==4 puts "nは4です" end for hellow in 1..5 do hellow="こんにちは" puts "#{hellow}" end
true
d22d40d5f7a9bc9bdfa5e5802b5d7f194757205d
Ruby
mongodb/mongoid
/lib/mongoid/loggable.rb
UTF-8
1,405
2.53125
3
[ "MIT" ]
permissive
# frozen_string_literal: true # rubocop:todo all module Mongoid # Contains logging behavior. module Loggable # Get the logger. # # @note Will try to grab Rails' logger first before creating a new logger # with stderr. # # @example Get the logger. # Loggable.logger # # @ret...
true
14c54b38f2f0260e311545882c7b5d60d423b596
Ruby
PaulDebevec/codewars
/get_sum/get_sum.rb
UTF-8
90
3
3
[ "MIT" ]
permissive
def get_sum(a,b) return (a..b).to_a.sum if a <= b return (b..a).to_a.sum if b < a end
true
099011722c3a4ed75a2ddf8f32d0cce431948e11
Ruby
shulmang/remote_diff
/lib/remote_diff.rb
UTF-8
3,089
2.90625
3
[]
no_license
#!/usr/bin/env ruby require "net/ssh" require 'map' DEFAULT_PATHS = %w( /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin /usr/local/mongo/bin /usr/local/apache2/bin /etc ) class RemoteDiff attr_reader :host1_connect_string attr_reader :host2_connect_string attr_reader :host1_user ...
true
969b7b15ecebfa7d51c5db97ba06d6d4d01538fa
Ruby
moneyadviceservice/wpcc
/features/step_definitions/your_details_steps.rb
UTF-8
6,920
2.703125
3
[ "MIT" ]
permissive
Given(/^I am on the Your Details step$/) do your_details_page.load(language_code: language_code) wait_for_page_load('your_details') end Given(/^I have valid details$/) do steps %{ Given I am on the Your Details step When I fill in my details And I proceed to the next step } end Given(/^I enter my ...
true
fb5ee1236283c13b30dcace34f6e1a4561fc7931
Ruby
KevinMulhern/customer_finder
/lib/customer_finder/distance_providers/haversine_distance.rb
UTF-8
1,404
3.234375
3
[]
no_license
module CustomerFinder module DistanceProviders class HaversineDistance EARTH_RADIUS_IN_MILES = 3956 EARTH_RADIUS_IN_KILOMETERS = 6371 def initialize(origin:, destination:, unit:) @origin = origin @destination = destination @unit = unit end def self.between(o...
true
6bb4a3d2a3068b72c467342bd8624e03f7936d5f
Ruby
iml-it/compiler-example
/lib/php_to_ruby/parser.rb
UTF-8
2,486
2.5625
3
[]
no_license
require 'rltk/parser' require 'rltk/ast' module PhpToRuby class Expression < RLTK::ASTNode end class Statement < RLTK::ASTNode end class Variable < Expression value :name, String end class Number < Expression value :value, Integer end class Constant < Expression value :name, String e...
true
154b47eaaa962aa215630186f3b8e1c87f934073
Ruby
davidakachaos/dyson-sphere-blueprints
/lib/engine/researches.rb
UTF-8
782
2.546875
3
[ "WTFPL" ]
permissive
class Engine::Researches include Singleton GAME_RESEARCHES_PATH = Rails.root.join("app/javascript/data/gameResearches.json") MASS_CONSTRUCTION_LIMITS = { "mass-1" => 60, "mass-2" => 120, "mass-3" => 600, "mass-4" => 3000, "mass-5" => Float::INFINITY, }.freeze def initialize @research...
true
79e3d89706bf71e1e50486c6522aab13fa82624b
Ruby
mroth/fashionhack
/spec/terms_spec.rb
UTF-8
877
2.53125
3
[]
no_license
require './lib/terms' require 'oj' describe "Terms" do before :all do terms_stub = Oj.load( '{ "@mroth":"Matthew Rothenberg", "@kellan":"Kellan Elliott-McCrea", "@curlyjazz":"Jasmine Trabelsi" }' ) @...
true
9d2892e4dba740e8b4b3b143099ff5f801ca0906
Ruby
lisenenkov-sl24/thinknetica
/Lesson1/4_quadratic_equation.rb
UTF-8
448
3.546875
4
[]
no_license
puts 'Коэффициенты уравнения a*x^2 + b*x + c = 0, через запятую' (a, b, c) = gets.chomp.split(',').map(&:to_f) d = b**2 - 4 * a * c if d < 0 puts "Дискриминант #{d}. Корней нет" elsif d == 0 puts "Дискриминант #{d}. Корень #{-b / 2 / a}" else sqrtd = Math.sqrt(d) puts "Дискриминант #{d}. Корни #{(b + sqrtd) / -...
true
3406beb800c7b2ce8ad51b53c0adc23ad12fdb27
Ruby
hasefumi23/nand2tetris
/nand2tetris/nand2tetris/projects/10/COMPILER/lib/jack_tokenizer.rb
UTF-8
6,090
3.265625
3
[]
no_license
# frozen_string_literal: true require 'pry' class JackTokenizer class CommentError < StandardError; end # DEBUG = true DEBUG = false KEY_WORDS = %w[class constructor function method field static var int char boolean void true false null this let do if else while return] SYMBOLS = %w[{ } ( ) [ ] . , ; + - *...
true
3c082a549cf27f7c592b70d656f80bfd63135269
Ruby
aleks2a/upthere
/framework/features/support/app.rb
UTF-8
282
2.75
3
[]
no_license
class App class << self def register_page_object(klass) method_name = klass.name.scan(/[A-Z][a-z]+/).map(&:downcase).join('_').to_sym return if self.method_defined?(method_name) define_method(method_name) do klass.new end end end end
true
437d34e05d32b2bf6c12b01aab617c9d9ac06bc5
Ruby
ianlenehan/cure8-api
/app/graphql/mutations/update_user.rb
UTF-8
624
2.53125
3
[]
no_license
module Mutations class UpdateUser < Mutations::BaseMutation description "Updates a new user" argument :first_name, String, required: true argument :last_name, String, required: true argument :phone, String, required: true field :user, Types::UserType, null: false field :errors, [String], nul...
true
cfe5d7d1e37aea1ad844d17f80269c1d8755e3b2
Ruby
Thisforbliss/prime-ruby-prework
/prime.rb
UTF-8
203
3.15625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Add code here! def prime?(number) value = true if number < 2 return false end (2...number).to_a.each do |num| if number % num == 0 value = false end end return value end
true
15f06d99d988c353f01c8b7814dd0e23e83817dc
Ruby
jessenovotny/ruby-music-library-cli-v-000
/lib/artist.rb
UTF-8
786
2.953125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Artist extend Concerns::ClassMethods extend Concerns::Findable include Concerns::InstanceMethods include Paramable attr_accessor :name attr_reader :songs, :genres @@all = [] def initialize name @name = name @songs = [] @all_genres = [] @@all << self self ...
true
496c59fcdf83060972d1ace9115693353879143c
Ruby
fsosa/tic-tac-toe
/tictactoe.rb
UTF-8
3,312
3.3125
3
[]
no_license
#! /usr/bin/env ruby class Board attr_accessor :grid attr_accessor :winner def initialize reset_grid end def print_grid @grid.each_with_index do |row, i| marker = row.nil? ? "" : row > 0 ? "X" : "O" print " #{marker} " print "|" unless i % 3 == 2 if i % 3 == 2 puts "" puts "-"*10 e...
true
92f7d46d041c52d0c9d9396e5ebb67565fcbbd84
Ruby
qcam/ruby_jard
/lib/ruby_jard/screens/variables_screen.rb
UTF-8
6,426
2.625
3
[ "MIT" ]
permissive
# frozen_string_literal: true module RubyJard module Screens class VariablesScreen < RubyJard::Screen TYPE_SYMBOLS = { # Intertal classes for those values may differ between Ruby versions # For example: Bignum is renamed to Integer # So, it's safer to use discrete value's class as t...
true
22bf06a33bdbd544f31e476247d08a934ef1019f
Ruby
dtrasbo/solve_sudoku
/lib/sudoku/solution_set/constraints/box_must_contain_value.rb
UTF-8
438
2.9375
3
[ "MIT" ]
permissive
module Sudoku class SolutionSet module Constraints class BoxMustContainValue def initialize(box_x, box_y, value) @box_x, @box_y, @value = box_x, box_y, value end def satisfied_by?(choice) choice.column.between?(@box_x * 3 - 2, @box_x * 3) && choice.ro...
true
332ac3445939332dddd7809bc912fc4cb8be1253
Ruby
opal/opal
/stdlib/console.rb
UTF-8
1,983
2.53125
3
[ "MIT" ]
permissive
# backtick_javascript: true require 'native' # Manipulate the browser console. # # @see https://developer.mozilla.org/en-US/docs/Web/API/console class Console include Native::Wrapper # Clear the console. def clear `#{@native}.clear()` end # Print a stacktrace from the call site. def trace `#{@na...
true
33f2147779aef9270a5ccb762fe1b27790aff33d
Ruby
jnapolitan/aA-homeworks
/W2D4/big_octopus.rb
UTF-8
1,322
3.703125
4
[]
no_license
def sluggish_octopus(fish_array) largest_fish = nil fish_array.each_with_index do |fish, fdx1| (fdx1 + 1...fish_array.length).each do |fdx2| largest_fish = fish_array[fdx1] if fish_array[fdx2].length > fish_array[fdx1].length largest_fish = fish_array[fdx2] end end end larges...
true
f4cc5f9e8ed18d3793be0c782e8bc9e7c856e195
Ruby
drew-beckmen/ruby-oo-object-relationships-belongs-to-lab-yale-web-yss-052520
/lib/author.rb
UTF-8
97
2.609375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Only requirement of author class is to have a name. class Author attr_accessor :name end
true
6b6f86583496ef9b03253ca66a70d84ffbf6caeb
Ruby
Cdale3/Date-Night
/test/node_test.rb
UTF-8
1,429
3.15625
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/node' require './lib/bst' require 'pry' class NodeTest < Minitest::Test def test_insert_default_node tree = Tree.new assert_equal 50, tree.head.score end def test_node_makes_node node = Node.new(53, "Flubber") assert_e...
true
cb6ac1476d967e30070384dabe2cf0a24d5de809
Ruby
nancylee713/perilous_journey
/lib/linked_list.rb
UTF-8
436
3.34375
3
[]
no_license
require './lib/node' class LinkedList attr_accessor :head def initialize @head = nil end def append(data) if @head.nil? @head = Node.new(data) else @head.append(data) end end def count @head.nil? ? 0 : @head.count(0) end def to_string result = "The #{@head.surnam...
true