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
2cd73ac377e5247904a14e60cfb96de882b6e540
Ruby
mallikClecotech/Ruby_practice
/set1/Hailstone.rb
UTF-8
475
4
4
[]
no_license
def hailstone_sequence(input_number) until input_number==1 do if input_number.even? puts "#{input_number} is even so i take half:: #{input_number /= 2}" elsif input_number.odd? puts "#{input_number} is odd so i make 3n+1:: #{input_number = input_number * 3 + 1}" end ...
true
613f50d1eb4a2d1c573697197da4167ef0eef936
Ruby
jkisor/price_range
/lib/company.rb
UTF-8
141
3.125
3
[]
no_license
class Company attr_reader :name, :price_range def initialize(name, price_range) @name = name @price_range = price_range end end
true
fa0e43c5998966a5dfe92a845f5b9b2356cec366
Ruby
taw/etwng
/db/db_pack
UTF-8
4,891
2.671875
3
[]
no_license
#!/usr/bin/env ruby require_relative "./db_schemata" require "pry" class DbTsvFile attr_reader :schema def parse_metadata!(metadata_line, table_name_from_dir) metadata = metadata_line.strip.sub(/\A"(.*)"(\s*,\s*)*\z/){$1}.split(/\s*,\s*/) raise "Metadata line unrecognized in #{@file_name}: #{metadata_line...
true
ca397478ed55239c7126c2d8f1a7292d84d23e07
Ruby
theprogrammerin/messenger-ruby
/lib/messenger/parameters/attachment.rb
UTF-8
484
2.671875
3
[ "MIT" ]
permissive
module Messenger module Parameters class Attachment attr_accessor :type, :url, :long, :lat def initialize(type:, payload:) @type = type set_payload_attributes(payload) end private def set_payload_attributes(payload) if @type == 'location' @long = ...
true
5f4ed3871c3323c9e032d79e11500552ddb07299
Ruby
kierblk/oo-counting-sentences-online-web-pt-081219
/lib/count_sentences.rb
UTF-8
767
4.1875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class String # Return true if the string you are calling it on ends in a period # Return false if it does not # use the self keyword # use the #end_with? method to determine what the final character raise def sentence? self.end_with?(".") end # method uses self # returns true if a s...
true
2d64d9d33bbd9cb6f8f9dcb8fdaaa6bc5df710f1
Ruby
connie-reinholdsson/oystercard
/lib/oystercard.rb
UTF-8
1,178
3.171875
3
[]
no_license
require_relative 'station' require_relative 'journey' #Card used for TFL travel class Oystercard MAXIMUM_BALANCE = 90 MINIMUM_BALANCE = 1 MINIMUM_CHARGE = 1 attr_reader :balance, :in_journey, :entry_station, :journey def initialize @balance = 0 @journey_history = [] end def top_up(amount) ...
true
a1cc473441f5bd62486a9e66ce1862e7248b8406
Ruby
katylamb2000/my-each-prework
/my_each.rb
UTF-8
135
2.96875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def my_each (collection) if block_given? i = 0 while i < collection.length yield (collection[i]) i = i + 1 end end collection end
true
f6d6971bc0a463b289fbcd8d71723969ce173b3d
Ruby
robertosequeira/short.rb
/app/models/short_url.rb
UTF-8
1,236
2.640625
3
[]
no_license
require 'mechanize' class ShortUrl < ApplicationRecord COLUMNS = %i[id full_url title click_count] METHODS = %i[short_code] validates :full_url, presence: true validate :validate_full_url scope :top, ->(top = 100) { limit(top).order(click_count: :desc) } scope :find_by_short_code, lambda { |short_code| ...
true
e0e12d903e70ee742b7d6ce19c974564196527e8
Ruby
shobhansuri/SpeedReading
/app/models/flashing_numbers_test.rb
UTF-8
1,817
2.625
3
[]
no_license
class FlashingNumbersTest < ActiveRecord::Base belongs_to :user attr_accessor :left_number, :right_number class << self def setup_for(test_taker) previous_test = FlashingNumbersTest.where(:user_id => test_taker.id).order("created_at desc").first new( :user => test_taker, ...
true
7c41b68f47ca9f3b187638ab3f303f338e0add14
Ruby
martinsing/chords
/app/models/unit.rb
UTF-8
1,661
2.59375
3
[]
no_license
require 'csv' class Unit < ActiveRecord::Base has_many :vars validates :name, uniqueness: false, presence: true validates_uniqueness_of :id_num, :scope => :source validates :unit_type, uniqueness: false validates :abbreviation, uniqueness: false, presence: true validates :source, uniqueness: false, ...
true
dccbf4ab53221ae40ed38813967bd8c08fc9dea6
Ruby
microsoftgraph/msgraph-sdk-ruby
/lib/models/access_package_catalog.rb
UTF-8
14,297
2.703125
3
[ "MIT" ]
permissive
require 'date' require 'microsoft_kiota_abstractions' require_relative '../microsoft_graph' require_relative './models' module MicrosoftGraph module Models class AccessPackageCatalog < MicrosoftGraph::Models::Entity include MicrosoftKiotaAbstractions::Parsable ## # The ...
true
b98206d592d0c6a84013a6e685c4b7c24230e6b8
Ruby
WESTKINz/practice
/mystuff/ex16.rb
UTF-8
1,041
4.15625
4
[]
no_license
filename = ARGV.first # this is an ARGV where user types the filename puts "We're going to erase #{filename}" puts "If you don't want that, hit CTRL-C (^C)." #command in powershell which will cancel the script puts "If you do want that, hit RETURN." $stdin.gets #ARGV is used so have to use $stdin puts "Opening the f...
true
6895984a230413f3d32a0d39ab7c95a485a56406
Ruby
EmileeSudweeks/programming-univbasics-4-array-methods-lab-online-web-prework
/lib/array_methods.rb
UTF-8
414
3.453125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def using_include(array, element) array.include?(element) end def using_sort(array) array.sort! end def using_reverse(array) it "takes in argument of an array and and returns the size, or length, of the array" do array = ["wow", "I", "am", "really", "learning", "arrays!"] expect(using_size(array)).to e...
true
086450f52b43831ba1013c55cc1f02eeb43599de
Ruby
zakkana/programming_lesson
/create_triangle.rb
UTF-8
71
2.703125
3
[]
no_license
(1..6).each do |i| (1..i).each do |u| print '*' end puts end
true
faff05bd9ac403186599f43d74c6dbad40f3cc55
Ruby
groshiniprasad/Sample
/spec/app/mars_spec.rb
UTF-8
746
2.859375
3
[]
no_license
require 'spec_helper' describe Mars do context "create areas" do it 'should only accept positive integers' do expect {Mars.new(-4,4).grid}.to raise_error expect {Mars.new(-4,0).grid}.to raise_error end it 'should return "[[.]]" when 1,1 is entererd ' do expect {Mars.new(1,1).grid}.s...
true
a5abf99cc82de322fd6489cc1fb14561e62bbbe6
Ruby
ArunSahadeo/chatly
/lib/twitch-bot/connection.rb
UTF-8
2,566
2.859375
3
[]
no_license
require 'twitch-bot/client' require 'twitch-bot/helpers' require 'twitch-bot/commands' Thread.abort_on_exception = true module TwitchBot class Connection attr_reader :active, :socket def initialize(params = {}) endpoint = params.fetch(:endpoint) port = params.fetch(:port) ...
true
59f8c333a6f9e4b1487457be3bbeb32a36e3a76e
Ruby
chapatt/autotracker
/stepper_rotor.rb
UTF-8
8,276
2.703125
3
[]
no_license
unless $simulate require 'rpi_gpio' end # unless $simulate require 'singleton' require_relative 'stepper.rb' require_relative 'core_extensions/numeric/angle.rb' Numeric.include CoreExtensions::Numeric::Angle require_relative 'core_extensions/numeric/steps.rb' Numeric.include CoreExtensions::Numeric::Steps class Ste...
true
c0b991dce80866264ff3c72e966fc48e587a537f
Ruby
Anas-Aa/ruby
/tic_tac_toe/Joueur.rb
UTF-8
1,362
3.953125
4
[]
no_license
load 'plateau.rb' class Joueur #variable static qui permet de donner un numero de pion different a chaque joueur @@numero_pion = 1 attr_accessor :plateau, :pion , :nom #constructeur de la classe joueur def initialize( plateau_de_jeu , name) @plateau= plateau_de_jeu @pion = @@numero_pion @nom =...
true
60e5f79338e57207534b7d4b936dcff4466d6ef5
Ruby
ashang/thor
/spec/fixtures/exit_status.thor
UTF-8
268
2.625
3
[ "MIT" ]
permissive
require "thor" class ExitStatus < Thor def self.exit_on_failure? true end desc "error", "exit with a planned error" def error raise Thor::Error.new("planned error") end desc "ok", "exit with no error" def ok end end ExitStatus.start(ARGV)
true
71c6eb6b69c2137bac80d48310dde09e557d6b7a
Ruby
BerilBBJ/scraperwiki-scraper-vault
/Users/A/amcewen/consultations_from_the_driving_standards_agency.rb
UTF-8
7,478
2.65625
3
[]
no_license
# Ruby scraper for consultations from the Driving Standards Agency require 'nokogiri' require 'uri' DEPARTMENT = "Driving Standards Agency" def scrape_page(url) # Details of the consultation record = { 'URI' => url, 'department' => '', 'agency' => DEPARTMENT } # Any documents linked from the consultation page ...
true
d1065097550f0e3f43bd8d7c26847a448c10c13a
Ruby
adornes/breaking_vigenere_cipher
/code_breaker.rb
UTF-8
4,647
3.546875
4
[]
no_license
# # Author: Daniel Adornes # Date: 03/30/2013 # class CodeBreaker attr_accessor(:cipher_text, :key_length, :key) def initialize(cipher_text) self.cipher_text = cipher_text end def decrypt # Find out the key length, unless it is already set @key_length = find_key_length unless @key_length ...
true
17b04a1c708096722b2467bd5c29ca84038caf7c
Ruby
austindatascience/Introduction-To-Programming-Launch-School
/Flow-Control/exercise2.rb
UTF-8
127
3.328125
3
[]
no_license
def caps(sentence) if sentence.length > 10 return sentence.upcase! end end puts caps("hello world")
true
8852fd300024bb1bcde81116b2c36e19428f1cae
Ruby
amoralist/cli-project
/bin/run.rb
UTF-8
4,352
2.796875
3
[ "MIT" ]
permissive
require_relative "../environment.rb" CLI.new.run # def cultural_scraper #KEEP THIS SCRAPER # url = "https://whc.unesco.org/en/statesparties/us" # html = open(url) # parsed_elements = Nokogiri::HTML(html) # unesco_cultural = parsed_elements.css("div.box li.cultural") # c...
true
0a8d173d503c90165f5d53f28abc365ac814fa15
Ruby
michaelglass/project-euler
/5.rb
UTF-8
1,215
3.515625
4
[]
no_license
#!/usr/bin/env ruby #find smallest/largest range... require 'time_this' require 'prime' #find minimum necessary factors of each from 1 to 20... needed = {} (1..20).each do |num| Prime.prime_division(num).each do |factor, power| needed[factor] ||= power needed[factor] = power if needed[factor] < power en...
true
b408f1e9df92dec50c5f963d3767fcd636cf4a6a
Ruby
soubhagyarnayak/CodingContestProblems
/AdventOfCode/2022/7/day7_1.rb
UTF-8
1,531
2.875
3
[]
no_license
file = File.open("day7_1.txt") input_data = file.readlines.map(&:chomp) fs_dir = Hash.new { |h, k| h[k] = [] } fs_files = Hash.new { |h, k| h[k] = [] } sizes = {} path = [] abs_path = "" max_size = 0 for line in input_data if line.start_with?("$ cd") dir = line[5...line.size] if dir==".." path.pop() ...
true
e280f77fe2af566f7ead1306be3e4fb023e99c1e
Ruby
ajosepha/rb_practice
/test1/test1.rb
UTF-8
307
3.625
4
[]
no_license
def temperature_bot(temp) # temperature bot is American but takes Celsius temperatures # case temp # when temp == 18 # "I like this temperature" # else # "This is uncomfortable for me" # end if temp == 18 "I like this temperature" else "I don't like this temperature" end end
true
87e509922dcde0f0adfbbbfc1a0576f09087a5f7
Ruby
umbrellio/polist
/spec/polist/builder_spec.rb
UTF-8
1,104
2.625
3
[ "MIT" ]
permissive
# frozen_string_literal: true class User include Polist::Builder builds do |role| case role when /admin/ Admin end end attr_accessor :role def initialize(role) self.role = role end end class Admin < User builds do |role| SuperAdmin if role == "super_admin" end class Sup...
true
eb23b4c23e80ead15bdc0100db4b518f4ee03220
Ruby
locomotivapro/bling
/lib/bling/api/order.rb
UTF-8
6,498
2.8125
3
[ "MIT" ]
permissive
module Bling module API # This class is used to make requests to all available # actions related to orders in Bling api. Is strongly recommended # to use the Bling::API module wrapper # class Order < Request # Get a list of available orders # # @example # orders = Bling::...
true
bb33ed86a761c1f6b675d7f00204dc989d621c64
Ruby
Amal-Subhash/delivery_service
/spec/ware_house_spec.rb
UTF-8
2,219
2.96875
3
[]
no_license
require 'spec_helper' describe WareHouse do before :each do @name = 'WareHouse_kochi' @code = 'Wh_koc' @address = 'kochi' @item = Item.new('Rolex', 'R1') @items_hash = {"R1"=>{:count=>5, :item=>@item}} end describe "#initialize" do it "should create a WareHouse with entered values" do ...
true
a5d9c0c533aca63d4714e16807a308dfd1557b2c
Ruby
isildonmez/OOP
/tic_tac_toe/tic_tac_toe.rb
UTF-8
1,495
4.15625
4
[]
no_license
class TicTacToe attr_accessor :board def initialize() puts "Rules:" puts "This is a game for two players, X and O, who take turns stating the coordinates in a 3×3 grid." puts "To state a coordinate, players should enter a number between 1..9 and not occupied number which can be seen as '.' " @boar...
true
5c79e38b62f316475e382257b4450d7bb9d421b3
Ruby
eremeyev/thinknetika-course
/ruby_basics/black_jack/lib/io.rb
UTF-8
1,291
3.5625
4
[]
no_license
class IO GAME_MENU = { '1' => 'Пас.', '2' => 'Взять карту.', '3' => 'Открываемся.' }.freeze def self.init_title puts '----- Black Jack -----' end def self.round_title(round_number) puts "----\nGame round: #{round_number}, Bank: 20." end def self.show_hands(opts) opts[:human_face...
true
8d1d84fa3984d79f5efe68266256cf82316b1297
Ruby
nametaketakewo/past-checker
/lib/past/checker.rb
UTF-8
1,649
2.546875
3
[ "MIT" ]
permissive
module Past def define_past_checker(name) attribute = self.class.checker_attribute(name) return false if attribute.nil? self.class.class_eval do define_method name do it = send(attribute) return nil if it.nil? (Time.try(:zone).try(:now) || Time.now) > it end end e...
true
3de9f9746b395b0ac89e97853c4dc46e7b8eaae2
Ruby
c-abramson/iterm2-blackjack
/app/spec/dealer_bust_spec.rb
UTF-8
1,431
2.578125
3
[ "MIT" ]
permissive
require "spec_helper" RSpec.describe App do let(:observer) { spy(:observer) } let(:table) { App::Table.new(observer) } let(:dealer) { table.dealer } let(:player) { table.player } let(:nine_of_clubs) { App::Card.new(9, App::Card::CLUBS) } let(:ten_of_hearts) { App::Card.new(10, App::Card::HEARTS) } let(:...
true
415f43a4d05f7edcc71c29b8fd083f2c29cebf3b
Ruby
osgood1024/ruby-oo-object-relationships-has-many-through-nyc-web-012720
/lib/waiter.rb
UTF-8
507
2.953125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Waiter attr_accessor :name, :yrs_experience @@all =[] def initialize(name, yrs_experience) @name=name @yrs_expereince=yrs_experience @@all << self end def self.all @@all end def new_meal(customer,total,tip=0) Meal.new(self,customer,total,ti...
true
86983e09b932cd899c4f3aaa3812b71eed06a978
Ruby
LupitaLee/quotes
/lib/quote.rb
UTF-8
379
3.359375
3
[ "MIT" ]
permissive
class Quote @@all =[] def initialize(quote_hash) quote_hash.each do |key, value| self.class.attr_accessor(key) self.send("#{key}=", value) end @@all << self end def self.all @@all end def self.find_by_name(author) self.all...
true
9ff40a53485724e7644afbf587f0459e3e346f4b
Ruby
javierhonduco/corruption_monkey
/test/cli_test.rb
UTF-8
1,163
2.640625
3
[ "MIT" ]
permissive
require 'minitest/autorun' require 'fileutils' require 'corruption_monkey' require_relative 'test_helpers' class TestCLI < Minitest::Test include TestHelpers TEST_DIR = '/tmp/bit_flipper_monkey_test_cli'.freeze def setup FileUtils.rm_rf(TEST_DIR) # Ensure clean state FileUtils.mkdir(TEST_DIR) end ...
true
9ff5ff608db42758cb1e109600c0fb4cdd1eadf6
Ruby
budgiestyle/ruby-objects-has-many-through-lab-v-000
/lib/appointment.rb
UTF-8
186
2.78125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Appointment attr_accessor :doctor, :name, :patient def initialize(name, patient) @name = name @patient = patient @appointments = [] patient.add_appointment(self) end end
true
daff9ffe32954ce117e4fbc578dd6b60ba386bd1
Ruby
dawanda/doctools
/spec/support.rb
UTF-8
938
3.21875
3
[]
no_license
module SpecSupport # Normalizes a string's indentation whitespace, so that heredocs can be used # more easily for testing. # # Example # # foo = normalize_string_indent(<<-EOF) # def foo # bar # end # EOF # # In this case, the raw string would have a large chunk of indentation ...
true
fd9c5ee61fdb0de55293fc3f4a7e502da480927b
Ruby
HideTheMess/Minesweeper_Solis_HIlty
/minesweeper.rb
UTF-8
3,459
3.59375
4
[]
no_license
require 'yaml' class Board attr_accessor :board def initialize(bomb_count = 10) @board = populate_board @bombs = bomb_count @gameover = false end def populate_board board = [] 9.times do |row| temp_array = [] 9.times do |col| temp_array << Tile.new(row, col, self) # Ma...
true
4ea30fd1fa8b1dc59b82bbbe12ed5b609492d5d1
Ruby
shezdev/honeycomb-makers-test
/spec/promotion_spec.rb
UTF-8
1,845
2.859375
3
[]
no_license
require "./lib/promotion" require "./lib/broadcaster" require "./lib/order" require "./lib/delivery" require "./lib/material" require "timecop" describe "Promotion" do describe "Promotion module" do let (:material) { Material.new 'WNP/SWCL001/010'} let(:order) { Order.new(material) } let(:broadcaster_1...
true
d8f61ca2e8a66988da040fdce755ab8adda4b8f4
Ruby
inpwjp/tiny-settings
/lib/tiny_settings.rb
UTF-8
765
2.8125
3
[ "MIT" ]
permissive
require "tiny_settings/version" require "methodize/hash" require "yaml" module TinySettings class Settings attr_accessor :file_path,:settings FILE_PATH = Dir.pwd def initialize() @file_path ||= [FILE_PATH ,"/", "settings.yml"].join @settings = {} self end def load begin ...
true
93b049a7bb0d96340c2d56216f97532e6c47e64a
Ruby
joseicosta/odf-report
/lib/odf-report/file_ops.rb
UTF-8
1,365
2.578125
3
[ "MIT" ]
permissive
module ODFReport module FileOps def random_filename(opts={}) opts = {:chars => ('0'..'9').to_a + ('A'..'F').to_a + ('a'..'f').to_a, :length => 24, :prefix => '', :suffix => '', :verify => true, :attempts => 10}.merge(opts) opts[:attempts].times do filename = '' ...
true
ebbe12edf55c4d4fadd1a934a96339287dd1ec40
Ruby
twhitinger/ruby
/ex42.rb
UTF-8
1,405
4.3125
4
[]
no_license
## Animal is-a object look at the extra credit class Animal end ## Dog is-a Animal class Dog < Animal def initialize(name) ## Dog has-a name @name = name end end ## Cat is-a Animal class Cat < Animal def initialize(name) ## Cat has-a name @name = name end end ## Person...
true
cc996cc3f54f8abc1ba95408681e484a09c045d8
Ruby
tylorschafer/monster_shop_extensions
/app/models/item.rb
UTF-8
1,425
2.578125
3
[]
no_license
class Item <ApplicationRecord belongs_to :merchant has_many :reviews has_many :item_orders has_many :orders, through: :item_orders validates_presence_of :name, :description, :price, :image validates_inclusion_of :active?, :in => [true,...
true
db85a8d8fb63a08c22e44956f4a176b10500f258
Ruby
greensoftwarelab/Energy-Languages
/JRuby/spectral-norm/spectralnorm.rb
UTF-8
1,187
3.390625
3
[ "MIT" ]
permissive
# The Computer Language Benchmarks Game # http://benchmarksgame.alioth.debian.org # Contributed by Sokolov Yura # Modified by Chris Houhoulis (April 2013): # - made loops uglier to avoid the unnecessary overhead of blocks # - nicer naming for readability ARRAY_LENGTH = ARGV[0].to_i u = Array.new(ARRAY_LENGTH, 1...
true
a0fd0fe3a269b89cc54120528263495f92e69dda
Ruby
David-Wobrock/advent2017
/day3/day3.rb
UTF-8
652
3.359375
3
[]
no_license
unless ARGV.length > 0 puts "Need an input" exit 1 end input = Integer(ARGV[0]) square_size = Math.sqrt(input).ceil if square_size % 2 == 0 square_size += 1 end istart = (square_size - 2) * (square_size - 2) + 1 iend = square_size * square_size dist1 = (square_size-1)/2 distances = [] middle = iend - d...
true
3395de7f7660f81d61c537290e60c910c758a6a0
Ruby
personal-niketa/NIKSMS
/app/models/school_class.rb
UTF-8
257
2.671875
3
[]
no_license
class SchoolClass < ApplicationRecord belongs_to :school has_many :class_sections def get_sections_by_name sections = "" self.class_sections.each do |sec| sections = [sections, sec.section_name].join(' ') end sections end end
true
7fadf582f3966f00ebb823972dda5ec7180b3540
Ruby
soroz30/codewars
/narcissistic.rb
UTF-8
633
3.640625
4
[]
no_license
def narcissistic?( value ) string_value = value.to_s.chars powers_of_digits = string_value.map {|i| i.to_i**string_value.length } sum_of_powers = powers_of_digits.inject(:+) sum_of_powers == value end ########## def narcissistic?( value ) value == value.to_s.chars.map { |x| x.to_i**value.to_s.size }.reduce(...
true
68b8b2cb14cac9a8671466c78706093c5fbdea86
Ruby
Morozzzko/epubmaker
/lib/epub_maker/cli/commands/generate.rb
UTF-8
1,674
2.546875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'gepub' require 'etc' require 'securerandom' module EPUBMaker module CLI module Commands class Generate < Dry::CLI::Command argument :path, type: :string, required: true, desc: 'Full destination path for epub' def call(path:, **) book = GEPU...
true
9068a557e09f9fbcf006e453d0204bcfd4230443
Ruby
kotakanazawa/everyday-ruby
/dup_hash.rb
UTF-8
458
3.109375
3
[]
no_license
original_hash = { a: 1, b: 2, c: 3 } hash_copy = original_hash hash_from_copy = hash_copy.dup p original_hash.object_id # 60 p hash_copy.object_id # 60 p hash_from_copy.object_id # 80 hash_copy.delete_if do |key, _value| key == :a end # オリジナルも破壊的変更がされる p hash_copy #=> {:b=>2, :c=>3} p original_hash #=> {:b=...
true
2dc1e08282c6947e94e49e5eac4fbcb1ed9e962f
Ruby
jordanpoulton/ruby_kickstart
/session2/4-spec/9.rb
UTF-8
1,587
3.375
3
[ "MIT" ]
permissive
require File.join( File.dirname(__FILE__) , 'helper' ) RSpec.describe 'deaf_grandma' do def call_deaf_grandma(input=String.new) input << "\nBYE\n" input_output(input) { deaf_grandma }.split("\n") end huh = 'HUH?! SPEAK UP, SONNY!'.freeze no = 'NO, NOT SINCE 1938!'.freeze it 'has no output when the...
true
7fc44f402a7be6a9a5ce5c31160233439fdc6cad
Ruby
irenealgi/RubyLearning
/Lesson_Two/functionsandvariables.rb
UTF-8
555
4.21875
4
[]
no_license
def print_two(*args) arg1, arg2 = args puts "arg1: #{arg1}, arg2: #{arg2}" end def print_two_again(arg1, arg2) puts "arg1: #{arg1}, arg2: #{arg2}" end def print_one(arg1) puts "arg1; #{arg1}" end def print_none() puts "I got nothing." end =begin print_two("Zed", "Shaw") print_two_again("Zed", "Shaw") prin...
true
edb059f77a723e8db07c96918f21d86f025c1269
Ruby
jamesallain/drugbank-sample-apps
/ruby/app.rb
UTF-8
7,612
2.984375
3
[ "Unlicense" ]
permissive
require 'rubygems' require 'bundler/setup' require "sinatra" require "httparty" require "json" require "haml" $config_file = "../config.json" # Try to read in the config file. # If it doesn't exist, create it with default values. if File.exist?($config_file) file = File.read $config_file $config = JSON.parse(...
true
087d921adfc88c8e1803cd8e59f7169789d6a87b
Ruby
genail/ginko_ruby
/lib/breadcrumbs/model.rb
UTF-8
894
2.640625
3
[]
no_license
require 'gio2' require 'callbacks' require 'preconditions' module Ginko::Breadcrumbs class Model extend Callbacks include Preconditions callback :on_file_changed def initialize @file = GLib::File.new_for_path("/") end def file=(file) check_argument(!file.nil?) ...
true
b5a1db5453ce6e99cc1435a1acc664959a629292
Ruby
WeilerWebServices/textmagic
/textmagic-rest-ruby/examples/templates.rb
UTF-8
1,855
2.8125
3
[ "MIT" ]
permissive
require 'rubygems' require 'textmagic-ruby' require './auth_helper' puts ' *** Running template examples *** ' # This is the preferred method to pass your API credentials # set the environment variables TEXTMAGIC_USERNAME and TEXTMAGIC_API_KEY in your shell username, api_key = tm_credentials # If you must, you can un...
true
d85d91eae75649b6e26935dd5d411f259a1ee507
Ruby
eliterry/ttt-8-turn-q-000
/lib/turn.rb
UTF-8
1,218
4.125
4
[]
no_license
def turn(board) puts "Please enter 1-9:" location = gets.chomp if valid_move?(board, location) move(board, location) else until valid_move?(board,location) puts "Invalid Input. Number Not Between 1-9, Or Space Taken. Please Enter 1-9 " location = gets.chomp end move(board, location) en...
true
5184163ec2910836aa6a7444b2c5c177a612fc02
Ruby
rclarkem/OO-Art-Gallery-dumbo-web-091619
/tools/console.rb
UTF-8
869
2.890625
3
[]
no_license
require_relative '../config/environment.rb' artist1 = Artist.new("Van Gogh", 13) artist2 = Artist.new("Leonardo", 7) artist3 = Artist.new("Rembrandt", 12) artist4 = Artist.new("Bob Ross", 7) gallery1 = Gallery.new("NYC Gallery", "Brooklyn, NY") gallery2 = Gallery.new("The Louvre", "Paris, France") gallery3 = Gallery....
true
6debf4357b7928e9f3181a5bbe7f9349ec5f005a
Ruby
Stricks1/TicTacToe
/lib/board.rb
UTF-8
725
3.328125
3
[]
no_license
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity require_relative 'winning' require_relative 'player' class Board < Winning attr_reader :grid @grid = [] def initialize @grid = [1, 2, 3, 4, 5, 6, 7, 8, 9] end def change_grid(number, char) number = number.to_i unless numbe...
true
7506213d2552ad179ef4d4ed8ea05ef6fd46be5d
Ruby
v-pukman/app_jonny
/app/models/baidu/backup/base.rb
UTF-8
545
2.5625
3
[]
no_license
class Baidu::Backup::Base BACKUP_FOLDER = "backup" def self.prepare_folders! path_in_backup_folder last_folder = BACKUP_FOLDER path_in_backup_folder.split('/').each do |folder| last_folder = "#{last_folder}/#{folder}" FileUtils.mkdir_p(last_folder) unless File.directory?(last_folder) end ...
true
5f8764696ede4107731c9fab3b6070db62948302
Ruby
ekim86/ruby-oo-practice-relationships-silicon-valley-exercise-nyc-web-120919
/app/models/startup.rb
UTF-8
1,487
3.125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Startup attr_reader :founder, :name, :domain @@all = [] def initialize(name, founder, domain='') @name = name @founder = founder @domain = domain @@all << self end def pivot(new_domain, new_name) @domain = new_domain @name = new_name end def sign_contract(venture_capitali...
true
2b517da5502a12069e572f668164eccb0c7aabd7
Ruby
bookmate/axlsx
/lib/axlsx/drawing/title.rb
UTF-8
1,901
2.921875
3
[ "MIT" ]
permissive
# encoding: UTF-8 module Axlsx # A Title stores information about the title of a chart class Title # The text to be shown. Setting this property directly with a string will remove the cell reference. # @return [String] attr_reader :text # The cell that holds the text for the title. Setting thi...
true
6689df1f6a61fd42b79eeef4229f8a89e374d335
Ruby
dcrocco/aydoo-2018-ruby
/Fibo5/spec/fibonacci_impar_spec.rb
UTF-8
269
2.828125
3
[]
no_license
require 'rspec' require_relative '../model/fibonacci_impar' describe FibonacciImpar do it 'Deberia devolver solo los valores impares' do fibo_impar = FibonacciImpar.new expect(fibo_impar.procesar([0, 1, 1, 2, 3, 5, 8, 13])).to eq [1, 1, 3, 5, 13] end end
true
2bd80c1868af62e3d0793c6781e2ecaae2e21cbc
Ruby
facboy/card_games
/server/src/game_state.rb
UTF-8
2,523
3.078125
3
[]
no_license
module CardGames require 'logger' class GameState attr_reader :groups, :players def initialize(initial_cards = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], initial_position = [10,10]) @logger = Logger.new(STDOUT) @players = [] @group_seq = 0 @groups = {}...
true
65e569b3b3b8e3cd61d276b067393ced954287b1
Ruby
MarynaYevnytska/codebreaker
/lib/modules/load.rb
UTF-8
824
2.640625
3
[]
no_license
FILE_NAME_SORT = '../sorting.yml' module Storage def save(object, file_path) File.new(file_path, 'w+') unless File.exist?(file_path) File.open(file_path, 'a') { |file| file.write(YAML.dump(object)) } end def save_sorting(object, file_path) File.new(file_path, 'w+') unless File.exist?(file_path) ...
true
f2e7b67ac35dedbf60ccc61d495aa59290a60991
Ruby
mindplace/bitly_clone
/runner.rb
UTF-8
1,735
2.890625
3
[]
no_license
require "net/http" require "uri" require 'pry' require 'json' require 'rails' # in order to use the Object#to_query method for an array of links def shorten_link(url) uri = URI.parse("http://localhost:3000/shorten") params = {"url": url} uri.query = URI.encode_www_form(params) JSON.parse(Net::HTTP.get(uri)) en...
true
72e5cfcfd53e1eee1466534940a7381b12753c8d
Ruby
bohdan0/Algorithms
/LeetCode/lib/find_disappeared_numbers.rb
UTF-8
538
3.625
4
[]
no_license
# Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. # Find all the elements of [1, n] inclusive that do not appear in this array. def find_disappeared_numbers(nums) result = [] idx = 0 while idx < nums.length if nums[nums[idx].abs ...
true
0db584cf7ba64d4321e80b612216e347e435d838
Ruby
WolfgangSteiner/PrettyComment
/lib/Examples.rb
UTF-8
2,318
2.78125
3
[]
no_license
# encoding: utf-8 require "./lib/PrettyComment" Summary = <<-EOL The play is set in Denmark at the Castle Elsinore. The King Hamlet has just died and his brother, Claudius, has replaced him and also married his dead brother's wife, Gertrude. In the second scene of ACT I, Claudius addresses the court on his recent marr...
true
1a2d80d6de02dbb1a3ed5c32e8f54538b7c533f6
Ruby
diingo/Hailinator
/hailinator.rb
UTF-8
790
2.890625
3
[]
no_license
require "twitter" require "CSV" Twitter.configure do |config| config.consumer_key = "" config.consumer_secret = "" config.oauth_token = "" config.oauth_token_secret = "" end tweets = [] Twitter.search("#hail", options = {:count => 10}).results.each do |tweet| tweets << [tweet.user.handle, tweet.text, twe...
true
ae37cbc3d59466c6e1740366e482c39ff66a82ea
Ruby
sacsar/lunch
/web.rb
UTF-8
1,151
3.046875
3
[]
no_license
require 'sinatra' class Restaurant attr_accessor :name, :location, :fast, :cheap def initialize (name, location, fast = false, cheap = false) @name = name @location = location @fast = fast @cheap = cheap end end bona=Restaurant.new("Bona","wash") jasmine=Restaurant.new("Jasmine Orchard","wash...
true
f1c7981aa4990ce529f98062d7f6eced82c7187e
Ruby
mthiede/rgen
/lib/rgen/util/pattern_matcher.rb
UTF-8
9,992
2.734375
3
[ "MIT" ]
permissive
module RGen module Util # A PatternMatcher can be used to find, insert and remove patterns on a given model. # # A pattern is specified by means of a block passed to the add_pattern method. # The block must take an Environment as first parameter and at least one model element # as connection point as further ...
true
4fb903cd7bd125c5f5ec293e02059fe649cb9f21
Ruby
eggyducktective/wdi-27-classwork
/week7/intro-to-tdd/lib/bank.rb
UTF-8
626
3.796875
4
[]
no_license
class Bank #give us a getter called .name to return the value of @name # (also a setter, which we don't use) attr_accessor :name attr_reader :accounts # gives us ONLY a getter for @accounts def initialize( name ) @name = name @accounts = {} end def create_account( account_name, amount=0) ...
true
c49bbbfdfa8bf199b58dbb7d6652d651345b3852
Ruby
PgrNascimento/digits
/spec/digit_spec.rb
UTF-8
706
3.09375
3
[]
no_license
require 'spec_helper' describe Digit do describe '.position' do it 'informa o número e a posição do algarismo informado' do expect(Digit.position(1)).to( eq 'O algarismo que está na posição 1 é o primeiro do número 1, portanto: 1' ) expect(Digit.position(10)).to( eq 'O algarism...
true
8dd34d390c66ec776fee119bad62f13e6b1a98f7
Ruby
sundus-y/gly
/lib/gly/gabc_convertor.rb
UTF-8
565
2.8125
3
[ "MIT" ]
permissive
require 'stringio' module Gly # takes Score, translates it to gabc class GabcConvertor def convert(score, out=StringIO.new) score.headers.each_pair do |key,value| out.print '% ' unless Headers.gregorio_supported?(key) out.puts "#{key}: #{value};" end out.puts '%%' scor...
true
74f0ca885a324e2c0211e8c8a50c68825eedeefa
Ruby
yana-gi/ruby-practices
/07.bowling_object/test_bowling.rb
UTF-8
1,709
2.953125
3
[]
no_license
# frozen_string_literal: true require 'test/unit' require './bowling' class TestBowling < Test::Unit::TestCase def test_shot_score assert_equal 1, Shot.new(1).score assert_equal 10, Shot.new('X').score assert_equal 0, Shot.new(nil).score end def test_frame_score assert_equal 3, Flame.new('1', ...
true
bd294643f877838116d2a40d587a6f9e4c52be7e
Ruby
claudia-mccormack/contacts-app
/prework/songlist.rb
UTF-8
817
3.734375
4
[]
no_license
# Class SongList class SongList def initialize @song_list = [] end def song_list return @song_list end def add_song(song) @song_list << song end def play @song_list.`say #{@lyrics}` end def shuffle @song_list.shuffle end def total_duration return total_duration end ...
true
53142dcb81b1d372e2e1ed9df6d7588256dd34d7
Ruby
TomasJendek/Zzz
/app/models/parser.rb
UTF-8
2,355
2.703125
3
[]
no_license
# -*- encoding : utf-8 -*- require 'open-uri' require 'net/http' require 'cgi' class Parser def regionParser begin #doc = Nokogiri::HTML(open("http://www.zzz.sk/?mesto=Bratislava")) #doc.encoding = 'UTF-8' ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') valid_string = ic.iconv...
true
1c2ac8d76bde5e9cce4094315fd3fef5557e7130
Ruby
Virtuoel/DiscordBot
/modules/about.rb
UTF-8
1,171
2.84375
3
[ "MIT" ]
permissive
def seconds_to_wdhms(seconds) seconds_diff = seconds.to_i.abs weeks = seconds_diff / (60 * 60 * 24 * 7) seconds_diff -= weeks * (60 * 60 * 24 * 7) days = seconds_diff / (60 * 60 * 24) seconds_diff -= days * (60 * 60 * 24) hours = seconds_diff / (60 * 60) seconds_diff -= hours * (60 * 60) minutes = seco...
true
403e0b66722522c63a42295de1fa8350088a3998
Ruby
RajGanguly/Algorithms
/Ruby/binary_search.rb
UTF-8
344
3.765625
4
[]
no_license
def binary_search(arr, k) n = arr.size l=0 h = n-1 while(l<=k) mid = l + (h-l)/2 if(arr[mid] == k) return mid elsif(arr[mid] < k) l=mid+1 else h=mid-1 end end return -1 end arr = [2,3,4,5,6,7] k = 6 x = bina...
true
ea920beb1beacd92ead7e7bf42f50fa56d9508c4
Ruby
gamache/brick
/app/models/stats.rb
UTF-8
8,762
3.109375
3
[]
no_license
require 'pp' class Stats < Hash ## Stats.new returns a Stats object (hash), with sane default values. class << self; alias_method :orig_new, :new end def self.new self.orig_new do |h,k| h[k] = Hash[:warps => 0, :games => 0, :nights => 0, :nights_won...
true
53b12752d8ead200c9699bd7ef2629c67a3f2b39
Ruby
spencerdavis2000/alice
/lib/rindlet.rb
UTF-8
3,732
2.71875
3
[ "MIT" ]
permissive
require 'rinda_client' require 'timeout' # Needed for errors - at least on some machines require 'socket' module Rinda class Rindlet NetworkErrors = [::Timeout::Error, ::Errno::EPIPE, ::SocketError, ::Errno::ECONNREFUSED] attr_accessor :rinda_client attr_accessor :pulse attr_accessor :numbe...
true
74f1a3de14c9d252b5c64077a6ddec0cc9ed328c
Ruby
tloveATL/sinatra-basic-routes-lab-atlanta-web-042219
/app.rb
UTF-8
300
2.546875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative 'config/environment' class App < Sinatra::Base get '/name' do "My name is Tiffani" end get '/hometown' do "My hometown is Marietta, GA" end get '/favorite-song' do "My favorite song is 'Who let the dogs out'" end end
true
1fb69ca95fb3cb41774f8e2e086e90d6a40ec61a
Ruby
AgileVentures/pairing_robot
/lib/pairing_robot.rb
UTF-8
1,163
3.296875
3
[]
no_license
require 'byebug' def run_code triple(3,4,5) end def fix_code(e) # byebug if e.class == NoMethodError /undefined method \`(.*)\' for main\:Object/ =~ e.message eval "def #{$1}; 'robot method' ; end " # would be cool to have the robot return a description of what it did to solve the error and why ... ...
true
33c6f3d298ae0a9f1f5ca067778765f5eec0d276
Ruby
itggot-erik-stenmark/standard-biblioteket
/dev/cube.rb
UTF-8
86
2.9375
3
[]
no_license
def cube(number) number = number*number*number return number end puts cube(-3)
true
17991bffa8e381e91f2efa39f301c034591ddbef
Ruby
Bogdansky/Ruby
/dec_to_hex.rb
UTF-8
515
3.140625
3
[]
no_license
=begin Реализовать алгоритм преобразования десятичного числа в шестнадцатеричное =end def parse_decimal number hex_values = ('0'..'9').to_a | ('A'..'F').to_a hex = "" decimal = number while decimal > 16 digit = (decimal / 16).floor rest = decimal - digit*16 decimal = d...
true
521cb7987bd7f4681b32d339ab6ce1bb17384ef8
Ruby
goodviber/poker_calculator
/lib/card.rb
UTF-8
544
3.34375
3
[]
no_license
class Card include Comparable attr_accessor :ordinal attr_reader :suit, :face SUITS = %i(h d s c) FACES = %i(2 3 4 5 6 7 8 9 10 j q k a) def initialize(str) @face, @suit = parse(str) @ordinal = FACES.index(@face) end def <=> (other) self.ordinal <=> other.ordinal end def to_s "#@...
true
1a801a0ff6071debff04296423b17e9c0581d20e
Ruby
dannybarrientos/learningruby
/herencia.rb
UTF-8
437
3.46875
3
[]
no_license
class Persona attr_accessor :nombre , :edad def saludar puts "Hola soy #{nombre}" end # def saludar end class Doctor < Persona attr_accessor :codigo def recetar puts "Doctor compre su pastilla" end end danny = Persona.new danny.nombre = 'Andres' danny.saludar barrientos = Do...
true
68970087e711974efe71bdfb384ee3e92390460d
Ruby
matthewhouse-89/baby-sittr
/spec/baby_sittr_spec.rb
UTF-8
3,612
2.953125
3
[ "MIT" ]
permissive
require 'baby_sittr' RSpec.describe BabySittr do it 'exists' do baby_sitter = BabySittr.new() expect(baby_sitter).to be_truthy end describe '#valid?' do context 'starts no earlier than 5:00PM' do it 'returns true if start time is 5PM' do result = BabySit...
true
4776c7def35d4c85f769b1dfee2aaee1267d36d8
Ruby
domi91c/ruby_chess
/main.rb
UTF-8
872
2.75
3
[]
no_license
require "ruby2d" require "chess_board" require "fen_interpreter" require "legal_move_finder" set title: "Chess" set height: 1000 set width: 1000 board = ChessBoard.new starting_position = "rnbqkbnr/pppppppp/7/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" positions = FenInterpreter.call(starting_position) squares = board.sq...
true
5be3889baff80e38182d06b63bcb1a273f67081c
Ruby
mimikaan/learntosolveit
/languages/ruby/being_rescue_else_ensure.rb
UTF-8
118
2.734375
3
[ "BSD-3-Clause" ]
permissive
begin puts "Hello, world!" 1/0 rescue => e puts e puts "rescue" else puts "else" ensure puts "ensure" end
true
160ea71a1e85cfa32b3d547055083007d3de8b7e
Ruby
meggyclarke/object_orientated_programing
/paperboy.rb
UTF-8
1,315
3.640625
4
[]
no_license
class Paperboy attr_accessor :name def initialize(name) @name = name @experiance = 0 @earnings = 0 end def deliver(start_address, end_address) houses = end_address - start_address @experiance = @experiance + houses if houses == quota money = houses * 0.25 elsif houses >= qu...
true
b9edd370e0d20b2c7205eb4b08650950b83582d1
Ruby
Jtpiland/young-thunder-2893
/spec/features/studios/index_spec.rb
UTF-8
909
2.5625
3
[]
no_license
require 'rails_helper' RSpec.describe 'Studio Index Page' do before :each do @universal = Studio.create(name: 'Universal Studios', location: 'Hollywood') @universal.movies.create(title: 'Raiders of the Lost Ark', creation_year: 1981, genre: 'Action/Adventure') @universal.movies.create(title: 'Shrek', cre...
true
198fbf2ec8703715c16526adbae1ffe561f46190
Ruby
LawrenceWhalen/fte_2103
/spec/food_truck_spec.rb
UTF-8
1,749
3.5625
4
[]
no_license
require './lib/food_truck' require './lib/item' RSpec.describe 'FoodTruck' do describe '#initialize' do it 'creates a food truck' do food_truck = FoodTruck.new('name') expect(food_truck.class).to eq(FoodTruck) end it 'has a name and no inventory' do food_truck = FoodTruck.new('name') ...
true
4111762caee490b88a9728abdbc91b72ae22f795
Ruby
izaz98/Ruby-Calender-Assignment
/lib/model/calender.rb
UTF-8
1,570
3.375
3
[]
no_license
# frozen_string_literal: true # Calnder class will be user to store the calender and events within it class Calender attr_accessor :current_year, :current_month, :events def initialize(current_month, current_year, events) @current_month = current_month @current_year = current_year @events = events e...
true
1d0c87e29691f492676a3998582d54b3bf934aa7
Ruby
IhorHudkov/Ruby-practice
/10/Lesson12/game_automat_with_hash.rb
IBM866
1,946
3.46875
3
[]
no_license
# encoding: cp866 puts ' "㪨 ", 2' score = 100 loop do puts ' 100 ஢, ?(y/n): ' answer = gets.strip.capitalize if answer == 'Y' puts ', ࠥ' break elsif answer == 'N' puts '..' exit else puts ' ⢥ ⥭..' end end puts '⮡ Enter' hh = {'000' => -50, '111' => 10, '222' => 20, '333' => 30, '444' => 4...
true
a9f214408fb10419bdd903945dac6178a48a2101
Ruby
stecco4/mugene
/pentatonic.rb
UTF-8
4,835
3.453125
3
[]
no_license
# beginnings of the music project # used for to_s methods - $note_names[pitch_class] #=> corresponding note name $note_names = ["C","C#","D","Eb","E","F","F#","G","Ab","A","Bb","B"] # used to represent notes # more data members will be added as they become necessary # should (hopefully) be immutable class Note def...
true
5777b9e2a25ac2efb8b9c68e6c466991cedb6897
Ruby
Janaeq/reverse-each-word-onl01-seng-pt-081720
/reverse_each_word.rb
UTF-8
392
3.546875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(string) reverse_string = string.reverse array = reverse_string.split reverse_array = array.reverse reverse_array.join(" ") end def reverse_each_word(string) array = [] new_array = [] new_string = string.reverse array << new_string.split array.collect do |word|...
true
1a83e73e28196fc5f5a39292c29d61a55a482dfd
Ruby
shafouz/data-structures-practice
/exercises/graph-trees/binary_tree_example.rb
UTF-8
1,119
3.6875
4
[]
no_license
# frozen_string_literal: true # poop class Node attr_accessor :root, :left, :right, :value def initialize(value) @value = value end end def push_node(node, value) if value > node.value if node.right push_node(node.right, value) else node.right = Node.new(value) end else if n...
true
705aa1be95f2e8979a37d254786f0678b2e7635e
Ruby
cyberalan8/transit
/lib/bustracker_parser.rb
UTF-8
3,086
2.984375
3
[]
no_license
require 'open-uri' module BusTrackerParser def BusTrackerParser.cta_time time = Nokogiri::XML(open("http://www.ctabustracker.com/bustime/api/v1/gettime?key=" + api_key)) Time.parse(time.xpath("//tm").text) end def BusTrackerParser.get_routes routes = {} routes_dump = Nokogiri::XML(open("http://...
true
fd8879458b8298aefcbb6fbc7b873e6e120910ed
Ruby
aisleypay/oo-kickstarter-web-040317
/lib/project.rb
UTF-8
361
3.171875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# When a backer has added a project to its list of backed projects, that project should also add the backer to its list of backers. class Project attr_accessor :backers attr_reader :title def initialize (title) @title = title @backers = [] end def add_backer(backer) self.backers << backer b...
true
a1b4b1ad15a6d673451a921fb6af32e25511ab27
Ruby
marofa/ruby-skillcrush-challenges
/always_three.rb
UTF-8
244
3.65625
4
[]
no_license
puts "Give me a number." first_number = gets.to_i mid_number = first_number + 5 mid_number = mid_number * 2 mid_number = mid_number - 4 mid_number = mid_number / 2 final_number = mid_number - first_number puts "Always #{final_number}"
true