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
b89b73204c8780ebc2b797d40e73172c9117b199
Ruby
snowistaken/ride-share-rails
/app/models/driver.rb
UTF-8
579
2.9375
3
[]
no_license
class Driver < ApplicationRecord has_many :trips validates :name, presence: true validates :vin, presence: true def average_rating(id) @driver = Driver.find_by(id: id) ratings = [] @driver.trips.each do |trip| ratings << trip.rating.to_f end return nil if ratings.empty? return (ra...
true
e5eac97fbf8f8e2e9b0c435c9323d735ac12894d
Ruby
Finble/learn_to_program
/ch09-writing-your-own-methods/old_school_roman_numerals.rb
UTF-8
442
3.578125
4
[]
no_license
def old_roman_numeral (num) raise 'Number must be positive' if num <= 0 roman_num = '' roman_num << 'M' * (num/1000) roman_num << 'D' * (num % 1000/500) roman_num << 'C' * (num % 500/100) roman_num << 'L' * (num % 100/50) roman_num << 'X' * (num % 50/10) roman_num << 'V' * (num % 10/5) roman_num << 'I' *...
true
7ea0212c6cc6605cf7a3c17daa51c10bd9431046
Ruby
supunic/Fortune-Checker
/vendor/bundle/ruby/2.6.0/gems/unparser-0.2.8/spec/support/parser_class_generator.rb
UTF-8
781
2.8125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module ParserClassGenerator def self.generate_with_options(base_parser_class, builder_options) # This builds a dynamic subclass of the base_parser_class (e.g. Parser::Ruby23) # and overrides the default_parser method to return a parser whose builder # has various options set. # # Currently the onl...
true
b222880b412fdc2c1043dda50421ae5091bbf6ac
Ruby
gutenye/tagen
/lib/tagen/core/array/extract_options.rb
UTF-8
1,086
3.3125
3
[ "MIT" ]
permissive
require "active_support/core_ext/array/extract_options" class Array # Extracts options from a set of arguments. # # @example # # dirs, o = ["foo", "bar", {a: 1}].extract_options(b: 2) # -> ["foo", "bar"], {a: 1, b: 2} # # (dir,), o = ["foo", {a: 1}].extract_options # -> "foo", {a: 1} ...
true
c4da98157a979a74694d7ef4bbde283cd17f1657
Ruby
gilnahmias/nextpoop
/EthernetFrame.rb
UTF-8
6,061
2.859375
3
[]
no_license
#!/usr/bin/env ruby require 'ipaddr' require 'pcaprub' # https://en.wikipedia.org/wiki/EtherType ETHER_TYPE = { 0x0800 => :ipv4, 0x0806 => :arp } module DataConverters def mac_address(byte_str) byte_str.unpack('C6').map { |s| sprintf('%02x', s) }.join(':') end def int8(byte_str) byte_str.unpack('C...
true
66e0864209ce9bcb42cf01c6e525bfc23369d155
Ruby
amair/pivotal_to_pdf
/lib/pivotal_to_pdf/story.rb
UTF-8
663
2.71875
3
[]
no_license
class Story < Pivotal def label_text return "" if !self.respond_to?(:labels) || self.labels.nil? || self.labels.empty? labels end def points return nil unless self.feature? "Points: " + (self.respond_to?(:estimate) && !self.estimate.eql?(-1) ? self.estimate.to_s : "Not yet estimated") end de...
true
3e455e0cb575485b2e48cf27c1b5040952d99039
Ruby
gautamrekolan/shop
/app/helpers/pages_helper.rb
UTF-8
643
2.859375
3
[]
no_license
module PagesHelper def preview (string, count = 300) # String::shorten (naiv) # Autor: Martin Labuschin # Erstellt am 29.Juli 2007 # String wird auf die durch count (optional, standard 30) bestimmte Anzahl von Zeichen gekürzt. Es werden dann ganze Wörter (erkannt durch Leerräume) zurückgegeben. Falls wirkli...
true
8b55c7b6beb720edce9de56f6bb72b431512d4e4
Ruby
now/rbtags
/lib/rbtags-1.0/file.rb
UTF-8
416
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- class RbTags::File def initialize(file, line) @file, @line = file, Integer(line) end def name @@expanded ||= Hash.new{ |files, file| files[file] = File.expand_path(file) } @@expanded[@file] end def line @@lines ||= Hash.new{ |lines, file| lines[file] = File.ope...
true
1350a0947c662955dadc33bd3fbe4e97a3cc1185
Ruby
MikeDulik/landlord-1
/models/Tenant.rb
UTF-8
199
3
3
[]
no_license
class Tenant attr_accessor :name, :age, :gender def initialize(initial_name, initial_age, initial_gender) @name = initial_name @age = initial_age @gender = initial_gender end end
true
28b479f7333e15438b106ed3ea1484056c89f167
Ruby
oamado/checkout
/basic_price_rule.rb
UTF-8
216
2.90625
3
[]
no_license
require_relative 'abstract_price_rule' class BasicPriceRule < AbstractPriceRule def initialize(base_price) @base_price = base_price end def calculate_price(quantity) @base_price * quantity end end
true
cd57448ad79609a00039db76c85bc39dab39a96c
Ruby
bjf-flatiron/ruby-project-guidelines
/lib/bank.rb
UTF-8
378
2.65625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Bank < ActiveRecord::Base has_many :accounts has_many :customers, through: :accounts def self.total_banks Bank.all.count end def self.Bank_id Bank.all.map {|b| [b.id, b.name]} end def self.find_id(name) x = Bank.find_by(name: name) p x.id end def self.create_new(name, location) self.create(name: ...
true
4ac98f02dcf686256ddfa4abcc7856a274af561a
Ruby
ewansheldon/Battle
/lib/game.rb
UTF-8
862
3.640625
4
[]
no_license
class Game attr_reader :attack, :players, :current_turn, :winner, :loser def initialize(player_1, player_2) @players = [player_1, player_2] @player_1 = player_1 @player_2 = player_2 @current_turn = player_1 end def player_1 @players.first end def player_2 @players.last end ...
true
d50a73d2182c619c58c62fcce5b2c6b7e1782988
Ruby
GreatMedivack/cwrc
/main.rb
UTF-8
12,950
2.59375
3
[]
no_license
require 'telegram/bot' require 'date' require 'ap' token = '' require 'sqlite3' @db = SQLite3::Database.new 'database.db' RES_MSG = "\u{1F4E5}<b>Изменения на складе:</b> \n" GET_MSG = "\t\t\n\u{1F53A}<b>Получено: </b>\n" LOS_MSG = "\t\t\n\u{1F53B}<b>Потеряно: </b>\n" NOTHING_MSG = "Нет изменений \n" ITEMS = [:id, :a...
true
2d32e7d8ac9eb65791efd6c90dfd50e8605d42b4
Ruby
dalen/puppet-defn
/lib/puppet/parser/functions/apply.rb
UTF-8
717
2.640625
3
[]
no_license
Puppet::Parser::Functions::newfunction( :apply, :type => :rvalue, :arity => -3, :doc => <<-'ENDHEREDOC') do |args| Call a Puppet lambda ENDHEREDOC require 'puppet/parser/ast/lambda' if args.length == 2 lam, arglist = *args else lam, arglist, pblock = *args unless pblock.respond_to?(:p...
true
1ba672f9f4c3b8f445c3440bf8a22c7a9453a09d
Ruby
redhataccess/ascii_binder
/lib/ascii_binder/distro_branch.rb
UTF-8
2,561
2.640625
3
[ "MIT" ]
permissive
require 'ascii_binder/helpers' include AsciiBinder::Helpers module AsciiBinder class DistroBranch attr_reader :id, :name, :dir, :distro, :distro_name, :distro_author def initialize(branch_name,branch_config,distro) @id = branch_name @name = branch_config['name'] @dir ...
true
3c8b41718eef3d0fdb706addb1d4bacf8cf660a8
Ruby
chenschel/tdd_blackjack
/tests/blackjack/card_runner.rb
UTF-8
244
2.78125
3
[]
no_license
# frozen_string_literal: true require_relative 'card' suit = 'Clubs' rank = '9' card = Card.new(suit, rank) puts "Suit of card: '#{card.suit}'" puts "Rank of card:'#{card.rank}'" puts "Card: #{card}" card.show = false puts "Card: #{card}"
true
3e031836c66eeafccd82c70b48de45d22a78ca0f
Ruby
Julioliveira/Ruby
/Exercises/hourMilitary.rb
UTF-8
512
3.1875
3
[]
no_license
militarHour = "-1"; hour12 = "" hour24 = 0 min = "" puts 'Enter the military hour' militarHour = gets.chomp hour24 = militarHour[0..1].to_i min = militarHour[2..3] if hour24 == 0 then hour12 = "12:#{min} a.m." elsif militarHour.size != 4 hour12 = "" elsif hour24 < 0 || hour24 > 23 || min.to_i > 59 hour12 = "...
true
04826eb897c669de3fa1b5b785438b094dc550da
Ruby
buihaian/gridlook
/spec/helpers/application_helper_spec.rb
UTF-8
541
2.53125
3
[]
no_license
require "spec_helper" describe ApplicationHelper do describe "#inspect_value" do def h(x) Rack::Utils.escape_html(x) end it "shows an array in paragraphs" do inspect_value(["foo", "bar"]).should == "<p>foo</p><p>bar</p>" end it "shows a hash value by value" do actual = inspect...
true
1ffb7b136e203ad08ab9dc47f71a93800c97b736
Ruby
donnymays/travel_api
/app/models/review.rb
UTF-8
1,180
2.5625
3
[]
no_license
class Review < ApplicationRecord # Validations validates :city, :country, :content, :rating, :user_name, presence: true validates :rating, numericality: { only_integer: true, less_than: 6, greater_than: 0} # Scopes scope :city, -> (city_name) { where("city ilike ?", "%#{city_name}%") } scope :country, -> ...
true
84f319e934ab067df3985bb006c47474caa86e60
Ruby
rishirajkumar97/vending_machine
/app/controllers/beverages_controller.rb
UTF-8
843
2.515625
3
[]
no_license
# frozen_string_literal: true # Beverages Controller to Get / Show/ Create new Beverages class BeveragesController < ApplicationController # Index method to get all the beverages def index beverages = Beverage.all render json: { items: ActiveModelSerializers::SerializableResource.new(beverages), ...
true
cced39d756b4c35a0122cf34f30a14792a3649ef
Ruby
staster86/Ruby_Lesson_24
/app.rb
UTF-8
1,531
2.6875
3
[ "MIT" ]
permissive
require 'rubygems' require 'sinatra' require 'sinatra/reloader' get '/' do erb "Hello! <a href=\"https://github.com/bootstrap-ruby/sinatra-bootstrap\">Original</a> pattern has been modified for <a href=\"http://rubyschool.us/\">Ruby School</a>" end get '/about' do erb :about end get '/visit' do erb :visit end ge...
true
bf082c7d931e2a7c84b0e22ce8c415c4205d6235
Ruby
sattelbergerp/pokemon-scraper-cb-000
/lib/pokemon.rb
UTF-8
503
3.296875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Pokemon attr_accessor :id, :name, :type, :hp, :db def self.save(name, type, db) db.execute("INSERT INTO pokemon(name, type) VALUES (?,?)", name, type) end def self.find(id, db) row = db.execute("SELECT * FROM pokemon WHERE id = ?", [id])[0] Pokemon.new(id: row[0], name: row[1], type: row[2], hp: row[...
true
6120914babeb49a022f15f78a1eb6a51e5327455
Ruby
Devtron3737/project_library
/RoutesAndControllers/bin/my_script.rb
UTF-8
761
2.734375
3
[]
no_license
require 'addressable/uri' require 'rest-client' # my_script.rb # def update_user # url = Addressable::URI.new( # scheme: 'http', # host: 'localhost', # port: 3000, # path: '/users/1.json' # ).to_s # # # begin # puts RestClient.patch( # url, # { user: { name: "newguy", email: "newguy@e...
true
cfce9bd8d1db8dcf61838e99e2ddcb5c52b927db
Ruby
mihir787/bizzspot
/app/services/mapbox_service.rb
UTF-8
549
2.703125
3
[]
no_license
class MapboxService attr_reader :connection def initialize @connection = Hurley::Client.new('http://api.tiles.mapbox.com') end def location(address) add = address.split.join(' ').gsub(/[^0-9a-z]/i, ' ').gsub(" ", "+") mapbox_body = parse(connection.get("v4/geocode/mapbox.places/#{add}.json?access_...
true
d0f5138bf23bfbc06bde1140a29395d73b1cd4c6
Ruby
jcmorrow/dominion-simulator
/big_money_player.rb
UTF-8
1,383
3.203125
3
[]
no_license
require_relative 'player' class BigMoneyPlayer < Player def buy_something case when @treasure == 3 && !(@deck.includes("Silver")) puts "I will buy a Silver" buy(Silver) when @treasure == 3 && @deck.includes("Silver") puts "I will buy a village" buy(Village) when (@treasure ==...
true
0a619cd289f9bb00ed1bc8ebd8fd7c84c57c5c1d
Ruby
reach075710/study_Ruby
/AtCoder/ABC/ABC_143/C.rb
UTF-8
193
3.125
3
[]
no_license
#set n = gets.chomp.to_i s = gets.chomp.split("") #main (0 .. n - 2).each do |i| if s[n - 1 - i] == s[n - 2 -i] then s.delete_at(n - 1 -i) end end print ("#{s.join.length}\n")
true
a4cf62e9fc810878a67e54d7fb521920a717c74b
Ruby
fumihiroito/poiful
/lib/poiful/result.rb
UTF-8
1,935
2.78125
3
[ "MIT" ]
permissive
module Poiful class LineprofResult def self.parse(raw_result) raw_result.map do |file_path, r| next unless r.size > 1 parse_result(file_path, r) end.compact end private def self.parse_result(file_path, result) file_result = nil begin file_result = File...
true
9e39beed1de18215a3bc7648f23db42069f4497c
Ruby
mpchadwick/jekyll-pre-commit
/lib/jekyll-pre-commit/checks/front_matter_variable_is_not_duplicate.rb
UTF-8
1,001
2.5625
3
[ "MIT" ]
permissive
module Jekyll module PreCommit module Checks class FrontMatterVariableIsNotDuplicate < Check def check(staged, not_staged, site, args) if !args["variables"] @result[:message] += "No variables to check." return @result end existing = Hash.new ...
true
8db5e11ef39daa5735dd6b837c7e5708c07fc6b7
Ruby
betten/SoundCloud-Developer-Challenge
/server.rb
UTF-8
6,016
2.859375
3
[]
no_license
#!/usr/bin/ruby require 'webrick' require 'stringio' require 'cgi' include WEBrick ####################################### # UploadData - an object to keep track of upload # data, includes progress hash and file path hash ######################################## class UploadData class << self; attr_accessor :progress...
true
63158b3b38fddd3fd93243102832a087834c371e
Ruby
KellenKolbeck/coin_counter
/lib/coin_counter.rb
UTF-8
755
3.484375
3
[]
no_license
class Fixnum define_method(:coin_counter) do coin_array = [0, 0, 0, 0] remainder = self if remainder > 25 coin_array[0] = (remainder/25).floor() remainder = remainder - coin_array[0]*25 end if remainder > 10 coin_array[1] = (remainder/10).floor() remainder = remainder - coi...
true
d856ab9aef369be4130280ce99108d23fc629376
Ruby
ElaErl/Challenges-1
/Easy1/point_mutations.rb
UTF-8
354
3.640625
4
[]
no_license
class DNA def initialize(strand) @strand = strand end def hamming_distance(other_strand) size = (other_strand.size < @strand.size) ? (other_strand.size) : (@strand.size) result = 0 @strand.each_char.with_index do |ch, ind| break if ind > (size - 1) result += 1 if ch != other_strand[in...
true
9d865228a6db7b8a0fbea14ad7b7eedf063dfbd5
Ruby
he9lin/wangdu
/lib/travel_sky/flights.rb
UTF-8
830
2.625
3
[]
no_license
# coding: utf-8 module TravelSky class Flights attr_reader :depart, :return, :data, :depart_dates, :return_dates, :depart_title, :return_title def initialize(data) @data = data @depart = data.xpath("//webFlightInfoList//webFlightInfo") @return = data.xpath("//w...
true
0d2c99c1ccfc6a0a4c716f155628afde4688a112
Ruby
Mizanur09/Ruby-Selenium
/acceptance_test/module/Common_Functions.rb
UTF-8
2,957
2.78125
3
[]
no_license
require_relative '../Helpers_pages/globalized' include Globalized module Functions def isElementPresent?(how, what) begin element = @driver.find_element(how, what) return element.displayed? rescue Exception => e return false end end def isElementVisible(locator) begin el...
true
21fafbb26d54bbd07d7afe2ed4a6f8f0e8c8f776
Ruby
benrodenhaeuser/exercises
/exercism/ruby/minesweeper/test.rb
UTF-8
733
3.828125
4
[]
no_license
# source: http://exercism.io/submissions/9cc87ce6845e4ee9940dbbfb7482cca2 # Whenever I see a grid like object that I need to index twice, I'll try and abstract away the grid such that I can index it using a method that checks that the indices are valid and that guarantees that it indexes correctly - preferably using x...
true
b753453139a9596f1de4520a215fd2e2d415033b
Ruby
mnsapits/AA-Projects
/w2d4/two_sum.rb
UTF-8
732
3.65625
4
[]
no_license
require "byebug" def bad_two_sum?(arr, target) idx1 = 0 while idx1 < arr.length idx2 = idx1 + 1 while idx2 < arr.length return true if arr[idx1] + arr[idx2] == target idx2 += 1 end idx1 += 1 end false end def okay_two_sum?(arr, target) sorted_arr = arr.sort (0...arr.length)....
true
7d6251d870acd48402922f2fce767c387f99572b
Ruby
srirammca53/update_status
/rubystuff/12-05-2011/arthoper.rb
UTF-8
718
3.921875
4
[]
no_license
class Arthematic def add() puts "enter any two numbers" @num1=gets() @num2=gets() @num3=@num1.to_i+@num2.to_i puts "the total addition by your numbers #@num3" end def sub() puts "enter any two numbers" @num1=gets() @num2=gets() @num3=@num1.to_i-@num2.to_i puts "the total substraction by your numbers #@nu...
true
c6c6478989b6bd86a3ef8ba60feb44ca05872939
Ruby
saurabhhack123/zerp
/lib/zerp.rb
UTF-8
337
2.921875
3
[ "MIT" ]
permissive
require "zerp/version" module Zerp # Your code goes here... class Chatter def say_hello if ARGV[0]=="help" puts "Dayo can help you in building ruby gem" elsif ARGV[0]=="time" puts Time.new else puts 'This is zerp. Coming in loud and clear. Over.' end ...
true
e73f7bbf152a70f474c8a85c85681fb6aa9ebc1f
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/src/2968.rb
UTF-8
497
3.046875
3
[]
no_license
def compute(first_strand,second_strand) first_strand_array = first_strand.split('') second_strand_array = second_strand.split('') diff_counter = 0 counter = 0 if first_strand_array.length >= second_strand_array.length length = second_strand_array.length else length = first_strand_array.length...
true
5bd64993b16876185629c4a73a1a80c8050bcd6a
Ruby
shockt88/HollandMedia
/SBIF/import55.rb
UTF-8
480
2.859375
3
[]
no_license
require 'csv' require 'awesome_print' class Grant def initialize(row) ##### Class Gramt @row = row #def initialize(company,address) end def company #@company = company @row.field("Company") #@address = adddress end end t...
true
f682cfda109540f20916623ace320bb15798c4cc
Ruby
emil-kirilov/Code-Runners-Problems
/bidding/app/helpers/users_helper.rb
UTF-8
176
2.515625
3
[]
no_license
module UsersHelper def self.authenticate(email, password) user = User.find_by(email) return nil if user.nil? return user if user.has_password?(password) end end
true
acc7f4a59ee13fd0ceb92e1b7b8b07528e390f52
Ruby
jamie-lb/projecteuler
/1/ruby/eulerProblem1.rb
UTF-8
88
3.375
3
[]
no_license
sum = 0; 0.upto(999) { |i| if i%3 == 0 || i%5 == 0 sum += i; end } puts sum;
true
d27799a741febbd62d395a207da20ba2aa7fefa5
Ruby
realtradam/bad-networking
/client.rb
UTF-8
1,530
3.03125
3
[]
no_license
require 'socket' require 'ruby2d' s = UDPSocket.new s.bind(nil, ARGV[0]) s.send("0 #{ARGV[0]}", 0, 'localhost', 4000) # ignore first message from server s.recvfrom(16) #sema = Mutex.new # Stores the current location of player location = "#{ARGV[0]} 0-0" # stores where squares last known locations are state = {} threa...
true
60ca81ff7d90cb613f848a2ee5231016b70bdea0
Ruby
saraid/OpenCatan
/server/lib/catan/turn.rb
UTF-8
12,600
2.671875
3
[]
no_license
require 'catan/action' require 'catan/trade' module OpenCatan class TurnStateException < OpenCatanException; end class Player # A turn begins when the previous turn ends. # A turn ends when the player submits DONE. class Turn def initialize(game) @game = game @actions = [] ...
true
9c95958c0c26560dbb9463815fbaa6fad8d8e204
Ruby
essian/assignment_sinatra_blackjack
/helpers/spec/human_player_spec.rb
UTF-8
633
2.640625
3
[]
no_license
require 'human_player' require 'view' require 'player_view' describe HumanPlayer do let(:human) { HumanPlayer.new } let(:poor_human) { HumanPlayer.new( { purse: 0 } )} describe '#purse_amount' do it 'starts out at 100' do expect(human.purse_amount).to eq(100) end end describe '#purse_empty?...
true
0af6782a4ab572fd14e4a399201c92647d9e7c52
Ruby
intfrr/Dotfiles-3
/scripts/web_search.rb
UTF-8
294
2.609375
3
[]
no_license
#!/usr/bin/env ruby require 'open-uri' term = ARGV[0] if term.empty? STDERR.puts "No search term specified" exit end escaped_term = URI.escape(term) if term.empty? STDERR.puts "Invalid search term" exit end base_url = "https://duckduckgo.com/?q=" `open #{base_url}#{escaped_term}`
true
2d214ad4cd307baf8943001ba3730a296203a50e
Ruby
thomanil/ruby101
/exercises/04/script.rb
UTF-8
1,544
2.84375
3
[ "CC-BY-4.0", "CC-BY-3.0" ]
permissive
# define methods... # Hint: For the basic part ot the task you can just pull from # a large dummy text, like the one below: lorem_ipsum = <<LOREM Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostru...
true
559de9ba6467879a024a820b7e2f59805d896c6c
Ruby
skageraz/ruby
/exo_14.rb
UTF-8
86
3.203125
3
[]
no_license
puts "choisis un nombre" n = gets.chomp.to_i (0..n).reverse_each do |n| puts n end
true
b2463e0366e910f9eb88fad5015104d94313810b
Ruby
oivoodoo/versionius
/lib/versionius/version.rb
UTF-8
747
2.546875
3
[ "MIT" ]
permissive
require 'grit' require 'versionomy' require 'rake' module Versionius class Version def initialize(project_path) @repo = Grit::Repo.new(project_path) @version = Versionomy.parse(tag.name) end def minor change(@version.bump(2)) end def major change(@version.bump(1)) e...
true
f27eb2aa71d10aa3403c0fe5f88b48f9a83d47c6
Ruby
renuo/ruby-basics
/overloading_setter_getter.rb
UTF-8
515
3.921875
4
[ "MIT" ]
permissive
class Food attr_reader :weight def initialize(_what, weight, _cals) @weight = weight end # overrides the attr_reader :weight def weight puts 'used custom getter' 2 end def weight=(weight) puts 'used custom setter' @weight = weight end end # Food.new(nil,nil,nil).calories doesn't ...
true
f09b56bb8369d41ae4f73092ab7c0552feb1dd63
Ruby
makevoid/try_clearwater_rc
/assets/js/serializers/invoices.rb
UTF-8
556
2.796875
3
[]
no_license
require 'models/invoice' require 'json' class InvoicesSerializer attr_reader :invoices def initialize invoices @invoices = invoices end def to_json invoices.map { |invoice| { id: invoice.id, name: invoice.name } }.to_json end def self.from_json json hashes = J...
true
f23833cd75ce2658912e860870c686a1e1cdc615
Ruby
johnnyji/math_game
/game.rb
UTF-8
1,338
3.796875
4
[]
no_license
class Game attr_accessor :game_over def initialize @player1 = nil @player2 = nil @current_player = nil @game_over = false end def play setup execute end ##### PRIVATE METHODS ##### private def setup @player1 = Player.new(prompt_player('player 1')) @player2 = Player.new(p...
true
eadcab38d0911b3fb71cc62310577eaa54adb9ca
Ruby
cadyherron/assignment_association_practice
/test_file.rb
UTF-8
1,732
2.828125
3
[]
no_license
#testingfile #Basic Output puts 'Users' print User.all puts 'Posts' Post.all puts 'Categories' Category.all puts 'Tags' Tag.all puts 'Comments' Comment.all #Relations puts 'User Relations' user = User.find(1) user.comments user.posts #Set a collection of comments to replace a user's current comments user.comme...
true
c46697cd5cc64444f7b0941ebdf4ef5edb90701c
Ruby
tristang/lexicon
/lib/lexicon.rb
UTF-8
16,541
2.640625
3
[]
no_license
require 'rwordnet' require 'ruby-progressbar' require 'lemmatizer' require 'linguistics' require 'pry' Linguistics.use(:en, monkeypatch: false) class Lexicon @@path = File.join(File.dirname(__FILE__), 'lexicon') SPACE = ' ' attr_reader :word_pos_frequencies, :ngram_frequencies, :word_list def initialize ...
true
93de1b291828e157f37e3e5c0b9c796b73125f94
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/anagram/fcb9827e2e754a0fa504c81f28b6db27.rb
UTF-8
388
3.703125
4
[]
no_license
class Anagram def initialize(subject) @subject = subject end def match(words) words.select { |word| anagram?(word) } end private attr_reader :subject def normalized_subject @normalized_subject ||= normalize(subject) end def anagram?(word) normalized_subject.eql?(normalize(word)) ...
true
c590741a66a7f12e88d42fff6ccc5c0753e5d23f
Ruby
harmolipi/ruby-projects
/bubble_sort.rb
UTF-8
308
3.59375
4
[]
no_license
def bubble_sort(array) sorted = false until sorted sorted = true for i in 0...(array.length - 1) if array[i] > array[i+1] array[i], array[i+1] = array[i+1], array[i] sorted = false end end end array end p bubble_sort([1, 3, 12, 105, 4, -5, 2, -26, 6, 2, 4])
true
5270cf6b23739736e388f67b6653ed831ee528d9
Ruby
franco84-2/reverse-each-word-001-prework-web
/reverse_each_word.rb
UTF-8
153
3.34375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(phrase) splitwords = phrase.split(" ") reversed_words = splitwords.map { |word| word.reverse} reversed_words.join(" ") end
true
3f17fdb720ad59d2db0b1beb6f6ed2371c2e05ff
Ruby
MITLibraries/archivesspace_export_service
/exporter_app/lib/process_manager.rb
UTF-8
2,283
2.5625
3
[]
no_license
class ProcessManager def initialize @processes_by_job = {} @log = ExporterApp.log_for("ProcessManager") end def start_job(job, completed_callback) @log.debug("Starting #{job}") process = Process.new(job, completed_callback) @processes_by_job[job] = process process.call end def shutd...
true
ce60c55896a925be74ba572738ddc9b9454ab125
Ruby
lkowalick/draftmaster
/app/models/round_factory.rb
UTF-8
544
2.953125
3
[]
no_license
class RoundFactory def self.build(draft) new(draft).send(:build) end private attr_reader :draft def initialize(draft) @draft = draft end def build round = draft.rounds.build(number: next_round_number) round.matches = pairs_of_players.map do |pair| match = Match.create match...
true
2b19c68ac5d4d3d5d2c390ff3220df2265d3cabb
Ruby
craysiii/twitchbot
/lib/twitchbot/message.rb
UTF-8
3,746
3.03125
3
[ "MIT" ]
permissive
require_relative 'user' module Twitchbot # Class responsible for parsing messages created in [EventHandler] # # TODO: Clean this up because its ugly # TODO: Parse message-id class Message # @return [Integer] Number of bits that have been included in a message attr_reader :bits # @return [User] Us...
true
59dce0036da17022738fdbb53131c98b6ff9e22d
Ruby
nejcik/AkademiaRebased
/task_4_PAGE_FORM/app.rb
UTF-8
1,051
2.578125
3
[]
no_license
require 'bundler' Bundler.require(:default) require 'sinatra/reloader' require_relative 'simple_user' require_relative 'forgot_password' class App < Sinatra::Base user = SimpleUser.new user.update_password get '/' do if user.current_user redirect '/logged' else erb :index end end...
true
e5e241b2d32099689d287fe2aa735f4fa9a24e57
Ruby
bgoonz/UsefulResourceRepo2.0
/_OVERFLOW/Resource-Store/Bootcamp-repos/Curriculum/02_SQL/W_7D4_SQL_Fundamentals/sql_zoo/spec/04_select_within_select_spec.rb
UTF-8
4,703
2.828125
3
[ "MIT" ]
permissive
require 'rspec' require '04_select_within_select' describe "SELECT within SELECT" do describe "larger_than_russia" do it "selects countries with a population larger than Russia" do expect(larger_than_russia).to contain_exactly( ["Bangladesh"], ["Brazil"], ["China"], ["India"...
true
d7a5e28c220db6f689fda06a1a17f4c63b4ab237
Ruby
Kate-v2/rails_engine_api
/spec/api/v1/filters/filtered_merchants_spec.rb
UTF-8
6,293
2.515625
3
[]
no_license
require "rails_helper" require "api_helper" RSpec.describe "Merchant Filtering API" do include APIHelper describe 'Find' do describe 'it filters name or id' do before(:each) do @merchant1, @merchant2, @merchant3 = create_list(:merchant, 3) end it 'finds by first name' do n...
true
2a22bb372d92e6f0581dcf00262da9f35368a6de
Ruby
pinapples73/week01
/day_5/homework/pet_shop.rb
UTF-8
2,384
3.421875
3
[]
no_license
def pet_shop_name(shop_name) return shop_name[:name] end def total_cash(shop_name) return shop_name[:admin][:total_cash] end def add_or_remove_cash(shop_name, amount_cash) return shop_name[:admin][:total_cash] += amount_cash end def pets_sold(shop_name) return shop_name[:admin][:pets_sold] end def increase_...
true
b899a04e868baa71cc2971fb90245ee3a15d7dca
Ruby
albertbahia/wdi_june_2014
/w03/d01/elizabeth_abernethy/hw_w03_d01/lib/pokemon_seed_script.rb
UTF-8
3,299
2.875
3
[]
no_license
require_relative './pokemon_seed.rb' require 'pry' <<<<<<< HEAD <<<<<<< HEAD require_relative './pokemon.rb' pokemon = get_pokemon pokemon.each do |pokemon| Pokemon.create({ name: pokemon[:name], image: pokemon[:img], hp: pokemon[:stats][:hp].to_i, attack: pokemon[:stats][:attack].to_i, defense:...
true
a6ab8fc8bb7892ce9b8f89483562bbe13a695175
Ruby
alcngrk/DesignPatternStuff1
/Velocity.rb
UTF-8
298
2.640625
3
[]
no_license
class StellarObj #.. #.. #.. end class Velocity def initialize(StellarObject) calculate_distance adjust_velocity(@distance) end def calculate_distance(StellarObject) @distance = calculate_distance(StellarObject) end def adjust_velocity(distance) #... end end
true
941ea83b2346f77ed30ac7bb3232a1aad4ec4890
Ruby
msloekito/launchschool_iterators
/exercise3.rb
UTF-8
125
3.234375
3
[]
no_license
pooch = ['pomeranian', 'spitz', 'samoyed', 'labrador', 'doberman'] pooch.each_with_index {|a, b| puts " #{b+1}. #{a} doge"}
true
aacbe66475226f97c32591be86b525dafb80fb15
Ruby
chazlarson/plex-dvr-post-processing
/process.rb
UTF-8
3,551
2.71875
3
[]
no_license
#!/usr/bin/env ruby require 'logger' require 'tmpdir' require 'shellwords' PLEX_MEDIA_SCAN_PATH = "/Applications/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Scanner" PLEX_COMSKIP_PATH = "/Users/john/development/PlexComskip/PlexComskip.py" HANDBRAKE_BIN = "/usr/local/bin/HandBrakeCLI" HANDBRAKE_PRESET = "Very F...
true
8e09bd82a9f82b1f7da1d2963df5fd853ef4d0ce
Ruby
bcurren/unison
/lib/unison/predicates/greater_than.rb
UTF-8
369
2.828125
3
[]
no_license
module Unison module Predicates class GreaterThan < BinaryPredicate def fetch_arel Arel::GreaterThan.new(operand_1.fetch_arel, operand_2.fetch_arel) end def inspect "#{operand_1.inspect}.gt(#{operand_2.inspect})" end protected def apply(value_1, value_2) ...
true
04782e2b6aa23c9f0fea2c61865869716fb28d5e
Ruby
nullstyle/online
/lib/online/tracker.rb
UTF-8
3,638
3.328125
3
[ "MIT" ]
permissive
module Online # # Keeps a fuzzy set of 'online' users in a provided redis store. # class Tracker SLICE_COUNT = 6 # # Creates a new tracker using the provided redis client. # # @param redis [Redis] the redis client to use # @param online_expiration_time=180 [Fixnum] The amount o...
true
c4e15ed78c07ddc9ae19760fd0b315704bd4586e
Ruby
appfolio/stewfinder
/lib/stewfinder/command.rb
UTF-8
1,079
2.875
3
[ "MIT" ]
permissive
require 'docopt' require_relative 'finder' require_relative 'version' module Stewfinder # Provides the command line interface to Stewfinder class Command DOC = <<-DOC stewfinder: A tool to help discover code stewards. Usage: stewfinder [options] [PATH] stewfinder -h | --help stewfinder --version Option...
true
1e3f15bee97d7a04cb0e0c07265bbcec47f4cac7
Ruby
motoyu5623/BookReview
/write_review.rb
UTF-8
440
3.453125
3
[]
no_license
def write_review(posts) post = {} puts "本のタイトルを入力してください" post[:title] = gets.chomp puts "本の評価(1〜5)を入力してください" post[:point] = gets.chomp.to_i if post[:point] < 1 || post[:point] > 5 puts "評価は1〜5で入力してください" return end puts "本の感想を一言入力してください" post[:review] = gets.chomp posts << post end
true
af302f6ac268f3fa710808d7a1be8011a21ec13f
Ruby
rellbows/Ruby101Project
/09_timer/timer.rb
UTF-8
1,384
3.8125
4
[]
no_license
class Timer #shortcut for GETTER method #attr_reader :seconds def initialize @seconds = 0 end #SETTER: this is how you change instance variables from outside def seconds=(new_seconds) @seconds = new_seconds end #GETTER: this returns the value of the instance variable def seconds @seconds end ###Th...
true
6959179e358dfed599616cc947c61b564141369d
Ruby
iamaimeemo/todo-ruby-basics-001-prework-web
/lib/ruby_basics.rb
UTF-8
542
3.90625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def division(num1, num2) return "#{num1}".to_f / "#{num2}".to_f end division 42, 7 def assign_variable (value) "#{value}" end assign_variable "Bob" def argue (phrase = "I'm right and you are wrong!") "#{phrase}" end argue def greeting (hello, name) puts "#{hello}, #{name}" end greeting "Hi there", "Bobby" d...
true
9665b334709c9e37b53911e037f7d707e63ccd6f
Ruby
LeanKhan/ruby_your_fada
/web_guesser/web_guesser.rb
UTF-8
492
2.828125
3
[]
no_license
# web_guesser app thingy require 'sinatra' require 'sinatra/reloader' get '/' do srand 1234 number = rand(101) srand 1234 guess = params["guess"] ? params["guess"].to_i : nil if(guess) if(guess > number) message = "Too High!" elsif(guess < number) message ...
true
3f5847936353527e1741fc8109deef696e2e6454
Ruby
VincentLloyd/scrapp
/lib/scrapp/game.rb
UTF-8
1,812
3.5625
4
[ "MIT" ]
permissive
class Game VALID_CHARS = [*'A'..'Z', '!', '*'].freeze LETTER_VALUES = { 'A' => 1, 'B' => 3, 'C' => 3, 'D' => 2, 'E' => 1, 'F' => 4, 'G' => 2, 'H' => 4, 'I' => 1, 'J' => 8, 'K' => 5, 'L' => 1, 'M' => 3, 'N' => 1, 'O' => 1, 'P' => 3, 'Q' => 10, 'R' => 1, 'S' => 1, 'T' => 1, 'U' => 1, 'V' => 4...
true
4f620af4facee80e1d95c39ee1c51056d356e54a
Ruby
poyben/add1920-ruben
/ut5/a1/net-change.rb
UTF-8
407
3.15625
3
[]
no_license
#!/usr/bin/env ruby def menu puts '1 - DHCP' puts '2 - Static' puts '3 - Domestic' input = gets.chop if imput == '1' system('dhclient eth0') elsif imput == '2' system('ip addr del dev eth0') system('ip addr add 172.19.26.31/16 dev eth0') elsif imput == '3' system('ip addr del dev eth0') system('ip addr...
true
53205236dcbb90c6edcee3ec234287b60e51959d
Ruby
serodriguez68/trailblazer-rails-basics
/app/services/my_transaction.rb
UTF-8
709
2.671875
3
[]
no_license
class MyTransaction extend Uber::Callable def self.call(options, *) result = ActiveRecord::Base.transaction { yield } # yield runs the nested pipe. # If correct, yield will return an array with a lot of stuff. On the first # position it will contain if the result is a rignt. # i.e # result[...
true
4f81bf086ccb658545cb1cdda027a55998916225
Ruby
EpicDream/shopelia
/lib/virtualis/report.rb
UTF-8
3,225
2.625
3
[]
no_license
module Virtualis class Report require 'csv' def self.parse(report_file) data = { :creation => [], :authorization => [], :compensation => [], :errors => [] } csv = CSV.read(report_file, col_sep:';') header = csv.shift unless header[0] == 'ENREG'...
true
7847bf45010c3a1aef9a8272ac0cd104e2d88543
Ruby
nessche/opencellid-client
/lib/opencellid/opencellid.rb
UTF-8
4,787
2.984375
3
[ "MIT" ]
permissive
require 'rexml/document' require 'net/http' require_relative 'cell' require_relative 'response' require_relative 'measure' require_relative 'bbox' require_relative 'error' # The module for the opencellid-client gem module Opencellid # The main entry for this library. Each method maps to the corresponding method of ...
true
62d0ac0dec184b8c48eacc1abfe599a303151b93
Ruby
kristjan/adventofcode
/2018/2/check.rb
UTF-8
363
3.53125
4
[]
no_license
ids = File.readlines(ARGV[0]).map(&:strip) def hist(s) Hash.new(0).tap do |h| s.chars.each {|ch| h[ch] += 1} end end def has_two?(s) hist(s).values.include?(2) end def has_three?(s) hist(s).values.include?(3) end twos = threes = 0 ids.each do |id| twos += 1 if has_two?(id) threes += 1 if has_three?...
true
61c7fe2f55cc06e1c9c51e5b682d9cfc5a862fd1
Ruby
markburns/maze
/app/models/point.rb
UTF-8
1,094
3.5
4
[]
no_license
class Point < Struct.new(:x, :y) include Visitor::Visitable def adjacent_to?(other) return false unless other.is_a?(Point) if left_of?(other) Path::Left elsif right_of?(other) Path::Right elsif above?(other) Path::Up elsif below?(other) Path::Down end end def h...
true
f3de302ff1bed97ca48a6dd4cdeb5b2d9b271195
Ruby
skube/dotfiles
/bin/twitter-followers
UTF-8
709
2.53125
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
#!/usr/bin/env ruby # GET https://api.twitter.com/1/friends/ids.json?cursor=-1&screen_name=twitterapi require "twitter" Twitter.configure do |config| config.consumer_key = ENV["CONSUMER_KEY"] config.consumer_secret = ENV["CONSUMER_SECRET"] config.oauth_token = ENV["OAUTH_TOKEN"] config.oauth_...
true
bb910a927ebc6bd08ae26af48c06fb2f19596e99
Ruby
nguyenquangminh0711/ruby_jard
/lib/ruby_jard/reflection.rb
UTF-8
3,439
3.375
3
[ "MIT" ]
permissive
# frozen_string_literal: true module RubyJard ## # User classes may override basic Kernel methods, such as #inspect # or #to_s, or even #is_a?. It's not very wise to call those methods # directly, as there maybe side effects. Therefore, this class is # to extract unbound methods from Kernel module, and then ...
true
ad4bcd6ac6de82e0d97458ec8ec4ff90a611f73a
Ruby
Jayyyy1011/programming-exercise
/28-word-count.rb
UTF-8
244
3.390625
3
[]
no_license
# 请打开 wordcount.txt,计算每个单字出现的次数 file = File.open("wordcount.txt") doc = File.read("wordcount.txt") arr = doc.split(" ") h = {} arr.each do |v| if h[v] == nil h[v] = 1 else h[v] += 1 end end puts h
true
ac270a2e856d033a6e0acbe7658a48598b98ac6e
Ruby
corewebdesign/dragonfly
/spec/dragonfly/serializer_spec.rb
UTF-8
2,264
2.59375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# encoding: utf-8 require 'spec_helper' describe Dragonfly::Serializer do include Dragonfly::Serializer describe "base 64 encoding/decoding" do [ 'a', 'sdhflasd', '/2010/03/01/hello.png', '//..', 'whats/up.egg.frog', '£ñçùí;', '~' ].each do |string| it "sho...
true
7d60729fb3056d7e4e156dbfded9041d907c24fc
Ruby
amcrawford/scrabble-score-keeper
/test/scrabble_test.rb
UTF-8
814
2.921875
3
[]
no_license
gem 'minitest' require './lib/scrabble' require 'minitest/autorun' require 'minitest/pride' require 'pry' class ScrabbleTest < Minitest::Test def test_it_can_score_a_single_letter assert_equal 1, Scrabble.new.score("a") assert_equal 4, Scrabble.new.score("f") end def test_it_can_score_a_word assert_...
true
6af349692a1d7924337fbf7282b7d863088060ce
Ruby
Marcos2015/Linux_Pra_Fast
/Ruby/Ruby/simple_grep.rb
UTF-8
232
2.875
3
[]
no_license
pattern=Regexp.new(ARGV[0]) file=File.open(ARGV[1]) file. each_line do |line| # 读取文件对象的每一行 if pattern =~ line #然后每一行判断是否匹配pattern,即模式匹配 print line end end file.close
true
a6f95bab68e439d1b1b5d172256ea7122a35a1b4
Ruby
mkrahu/launchschool
/100_program_backend_prep/ruby_book/methods/return.rb
UTF-8
174
3.734375
4
[]
no_license
# return.rb # Exercise in Ch3 'Method' in the LaunchSchool Learning to Program Ruby def add_three(number) number + 3 end returned_value = add_three(4) puts returned_value
true
00482664f8e5d1327e4e19f45175c7ac4f030b72
Ruby
ecksma/wdi-darth-vader
/04_ruby/d02/Myron_Johnson/ruby/hw_movie.rb
UTF-8
387
3.515625
4
[]
no_license
class Movie def initialize(title, year, include_year=false) @title = title @year = year @include_year = include_year end def title @title end def year @year end def include_year @include_year end def full_title if include_year retur...
true
4b99443433d1b50739a3e3f781036cfac726b4d8
Ruby
Kangb0tmang/wdi13_warmups
/concat_unique_strings/string.rb
UTF-8
151
3.140625
3
[]
no_license
str1 = 'xyaabbbccccdefww' str2 = 'xxxxyyyyabklmopq' def longest(str1, str2) str1.concat(str2).split('').uniq.sort.join end puts longest(str1, str2)
true
094e2e4f904d9feee5212b3d5b3fec4f7824257c
Ruby
joe42go/lesson_4
/ls_ttt.rb
UTF-8
6,225
3.96875
4
[]
no_license
# 1. Display the initial empty 3x3 board. # 2. Ask the user to mark a square. # 3. Computer marks a square. # 4. Display the updated board state. # 5. If winner, display winner. # 6. If board is full, display tie. # 7. If neither winner nor board is full, go to #2 # 8. Play again? # 9. If yes, go to #1 # 10. Good bye! ...
true
d63d2dd13a504cc61fb47492c9896397e05dd23b
Ruby
tp00012x/Ruby-Course
/Introduction/statement_modifiers.rb
UTF-8
204
3.703125
4
[]
no_license
number = 5000 if number > 2500 puts 'Huge number' end puts 'Huge number!' if number > 2500 # if 1 < 2 puts 'Yes, it is!' else puts 'No, its not!' end puts 1 < 2 ? 'Yes, it is!' : 'No, its not!'
true
80bce8d362afc723001306458c4dd648eb025c07
Ruby
izumin5210/syncfiles-prototype
/datastore.rb
UTF-8
531
2.71875
3
[]
no_license
class Datastore PATH = 'data.json' def initialize @data = JSON.parse(open(PATH).read).with_indifferent_access rescue Errno::ENOENT @data = { tokens: {}, pulls: {}, }.with_indifferent_access save end def token_for(slug:) @data.dig(:tokens, slug, :token) end def set_token(...
true
3adcafa64f3247de5b73f0f94a40c332f5502eb6
Ruby
jasonmiles/introduction_to_programming
/easyquiz1_question9.rb
UTF-8
268
3.234375
3
[]
no_license
flintstones = {"Fred"=>0, "Wilma"=>1, "Barney"=>2, "Betty"=>3, "BamBam"=>4, "Pebbles"=>5} barney = flintstones.to_a[2] arr = ["Fred", "Barney", "Wilma", "Betty", "Pebbles", "BamBam"] hash = Hash.new arr.each do |word| hash.store(word, arr.index(word)) end p hash
true
a1e40db3175ec32566c0db1db17cdacd6f454bbc
Ruby
fabiopio/pact
/webmachine/database.rb
UTF-8
480
2.953125
3
[]
no_license
require "sequel" class ZooDB def initialize db = Sequel.sqlite db.create_table :animals do primary_key :id String :name String :specie end @animals = db[:animals] end def insert_an_animal(name, specie) @animals.insert(:name => name, :specie => specie) end def get_first_animal @a...
true
fe26ece4909f4642b528c252193cb73f7fc08d54
Ruby
bluurosebud/minedmindskata
/math_functions/pizza.rb
UTF-8
84
2.546875
3
[]
no_license
def crust() result=["stuffed","thin","pan","deep dish"].sample p result end crust
true
84199cf654cbae8a0dac2c439ce10dc4513db4e7
Ruby
paalvibe/zizou
/lib/ranking.rb
UTF-8
6,797
2.875
3
[]
no_license
# -*- coding: utf-8 -*- require 'slack' require 'terminal-table' require 'pp' class Ranking def self.usernames_in_game(game) names = {team1: [], team2: []} {team1: game.team_player1.player, team2: game.team_player2.player}.each do |team, player| if player.is_a? PairPlayer usernames = player.us...
true
3cb27832531d8ea7b0070144a9cd4307f822eea7
Ruby
mleone/questions
/reverse_list_mutation.rb
UTF-8
593
3.640625
4
[]
no_license
require_relative 'lib' # For each node, make it point to the previous node, and then run the function # again on the following node, with the current node as the previous node. def reverse_list_mutation(list, previous=nil) next_node = list.next_node list.next_node = previous if next_node reverse_list_mutati...
true
1cf7af4d8e6901fb4d3d4e98db3964c16955c3af
Ruby
brahamshakti/word_transformer
/lib/transformer.rb
UTF-8
1,495
3.234375
3
[]
no_license
require_relative 'graph' class Transformer < Graph def initialize(words) super() @word_nodes = add_nodes(words) end def is_diff_one?(str1, str2) return false if(str1.size != str2.size) count = 0 for i in 0...str1.size if(str1[i]!=str2[i]) count = count+1 return false...
true
1b20a80b44b50906a21061eba719093b6bfc1fa1
Ruby
saracastellino/w2_d2_RUBY_multipleclasses_homework
/river.rb
UTF-8
392
3.484375
3
[]
no_license
class River attr_accessor :name, :fishes def initialize(name, fishes) @name = name @fishes = fishes end def number_of_fishes() return @fishes.length end def add_fish(fish) @fishes.push(fish) end def remove_fish @fishes.pop end # # # def pick_from_stop(bear) # bear.stomach...
true