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
44fa611ec56e3af65d4d443fb00d3291a5a8b5eb
Ruby
kamaradclimber/advent-of-code-2020
/days/day6.rb
UTF-8
555
3
3
[ "Apache-2.0" ]
permissive
# frozen_string_literal: true require 'aoc' module CharSet refine String do # uniq chars from a string without \n def char_set gsub("\n", '').chars.uniq end end end class Day6 < Day using CharSet def solve_part1 groups.map(&:char_set).map(&:size).sum end def solve_part2 groups....
true
30ddb714ef1362aa6be23e5e724a7a0a0a5bf5a3
Ruby
FM-HXR/furima-34588
/lib/csv_hasher.rb
UTF-8
1,351
2.921875
3
[]
no_license
require 'csv' module CsvHasher module Hasher def self.hasher(row_label, hash_list, count) hash = {} hash[:id] = count.to_i hash[:option] = row_label if hash[:option] != nil hash_list << hash end end end def self.get_hashes(list) csv = "#{Rails.root}/lib/collecti...
true
d8025aa7e9efd5fda113d621e62c554a9cc182b8
Ruby
CGW/Givegoods
/app/models/campaign_stat.rb
UTF-8
755
2.609375
3
[]
no_license
class CampaignStat attr_reader :campaign def initialize(attributes = {}) attributes.each do |attr, value| self.send(:"#{attr}=", value) end @campaign ||= Campaign.new end def campaign=(campaign) return unless campaign.is_a?(Campaign) @campaign = campaign end def donations_cou...
true
4daa321d65966d28be90eb04c7a94024d4c64ca9
Ruby
dahal/GemList
/app/helpers/gem_name.rb
UTF-8
322
2.8125
3
[ "MIT" ]
permissive
helpers do def remove_version_number(gem_name) name_array = gem_name.split("-") name_array.delete_at(-1) name_array.join("-") end def version(gem_name) gem_name.split("-").pop end def gem_link(gem_name_with_version) "http://rubygems.org/gems/"+ "#{remove_version_number(gem_name_with_version)}" end e...
true
5e00f2b15ea35a81bbe64d6a3c8390278be2f601
Ruby
kamok/jr-rails-interview-questions
/interview_1/code_challenge_1.rb
UTF-8
1,092
4.15625
4
[]
no_license
# Caution: Make sure you keep in mind of case sensitivity when coding without a good text editor eg Google Docs. # You have a list with these numbers in this order [ 1, 0, 5, 2, 10, 8, 12, -1 ]. # Create a Function that will return the minimum and the maximum values in the list. # Without .min, .max, or .sort # { min...
true
9814be130f28ed92e600c8d7990aeccda5637fe4
Ruby
Solveug/RR
/9/9_1.rb
UTF-8
637
3.1875
3
[]
no_license
# frozen_string_literal: true temp = ARGV[0] season = ARGV[1] if temp.nil? puts 'Какая сейчас температура?' temp = $stdin.gets.to_i end if season.nil? puts 'Какое время года? (0 - весна, 1 - лето, 2 - осень, 3 - зима)' season = $stdin.gets.to_i end if temp.between?(15, 35) && season == 1 puts 'Скорее идит...
true
be597283e295dd8c00917584ec23296734d94581
Ruby
ardavis/Codec-Andy
/lib/codec_andy/decoder.rb
UTF-8
2,062
3.265625
3
[]
no_license
####################################################### # decoder.rb # # Author: Andrew R. Davis # School: Kettering University # # This decoder is meant to read an encoded file and # spit out a jpg image. # ####################################################### $LOAD_PATH.unshift(File.dirname(__FILE__)) r...
true
98f389b6258fd40ee58356328bd391d985887ef6
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/raindrops/009f9ae048c842a4b5b163cabc03e3f4.rb
UTF-8
608
3.640625
4
[]
no_license
class Raindrops def self.convert(number) result = "" result += "Pling" if self.has_prime_factor_3?(number) result += "Plang" if self.has_prime_factor_5?(number) result += "Plong" if self.has_prime_factor_7?(number) return number.to_s if result == "" result end private def self.has_prim...
true
5685ee02468a0c3a058111b3b2b9ed39341491f3
Ruby
flada-auxv/reversi
/spec/board_spec.rb
UTF-8
6,799
2.921875
3
[]
no_license
require 'spec_helper' describe Reversi::Board do let(:game) { Reversi::Game.new } let(:board) { Reversi::Board.create } let(:n) { Reversi::Piece.new } # none_piece let(:ul) { Reversi::Piece.new(3, 3, :white) } # upper_left_white_piece let(:ur) { Reversi::Piece.new(3, 4, :black) } # upper_right_black_piece ...
true
8259e5e463f3f80f6809b86a64e0baf2c68281a8
Ruby
AdaoNatalino/ruby-oo-object-relationships-kickstarter-lab-lon01-seng-ft-042020
/lib/project.rb
UTF-8
382
3.171875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Project attr_reader :title, :add_backer def initialize(title) @title = title end def add_backer(backer) ProjectBacker.new(self, backer) end def backers a = ProjectBacker.all.select {|array| array.project == self} a.m...
true
9c74ae5e6ed5b4286d7aaad49be9a87d5ef4c594
Ruby
tennin/leaern_to_program
/chap10.rb
UTF-8
191
3.46875
3
[]
no_license
def factorial num if num < 0 return ' you can\'t take the factorial of negative value' end if num <=1 1 else num * factorial(num-1) end end puts factorial(3) puts factorial(4)
true
21b624ff67b62e428cca510e08dcfbc424d78b3a
Ruby
xfun68/codejam
/lcd_dada/lib/lcd_number.rb
UTF-8
1,534
3.59375
4
[]
no_license
class LCD DIGITS = [ [ " - ", "| |", " ", "| |", " - " ], [ " ", " |", " ", " |", " " ], [ " - ", " |", " - ", "| ", " - " ], [ " - ", " |", " - ", " |", ...
true
9aeadd6f3d58072179a4867f63b6a3f6489d9e00
Ruby
juliandunn/opscode-omnitruck
/spec/chef/bucket_lister_spec.rb
UTF-8
3,059
2.5625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'spec_helper' describe Chef::BucketLister do let(:lister) { described_class.new('test_bucket') } describe '#fetch' do before do allow(lister).to receive(:key_of) allow(lister).to receive(:etag_of) allow(lister).to receive(:last_modified_of) end context 'when all keys are fet...
true
1762b69de894249a9428be5390b23ac5ac310119
Ruby
Shniks/trippin
/app/presenters/park_presenter.rb
UTF-8
501
2.546875
3
[]
no_license
class ParkPresenter def initialize(params) @params = params end def parks_search found_parks end def current_location {lat: lat, long: long} end private def found_parks Park.geocoded_by(latitude: lat, longitude: long) Park.near([lat, long], @params[:radius]) end def...
true
56c23077954071912c07d22c538a8c7d91081877
Ruby
clayallsopp/formotion
/lib/formotion/form/form.rb
UTF-8
9,190
2.859375
3
[ "MIT" ]
permissive
motion_require "../base" module Formotion class Form < Formotion::Base extend BubbleWrap::KVO include BubbleWrap::KVO PROPERTIES = [ # By default, Formotion::Controller will set it's title to this # (so navigation bars will reflect it). :title, # If you want to have some internal...
true
94edad36b5d7d9f42ce802d4e878ccfa1d188748
Ruby
CodingDojoDallas/ruby_feb_2018
/chris_miller/first_vagrant_box/oop/lion.rb
UTF-8
438
3.484375
3
[]
no_license
require_relative 'mammal' class Lion < Mammal def initialize(health = 170) @health = health self end def display_health super end def fly @health -= 10 self end def attack_town @health -= 50 self end def eat_humans @health += 20 self end end leo = Lion.new leo.display_health matt = M...
true
6c5f1135a7b286e5f3c1e2baf8d3daed6ed74606
Ruby
gregfitz23/leaderbeerd
/lib/processor.rb
UTF-8
1,361
2.546875
3
[]
no_license
require File.join(Leaderbeerd::Config.root_dir, "app/models/checkin") require File.join(Leaderbeerd::Config.root_dir, "app/models/user") require File.join(Leaderbeerd::Config.root_dir, "lib/checkin_parser") module Leaderbeerd class Processor def process(*usernames) options = {} options[:whe...
true
a144d36c49bb4a1e310964b6fefd469da2b287cb
Ruby
taish/rails_app
/config/schedule.rb
UTF-8
2,553
2.546875
3
[]
no_license
# Use this file to easily define all of your cron jobs. # # It's helpful, but not entirely necessary to understand cron before proceeding. # http://en.wikipedia.org/wiki/Cron # Example: # # set :output, "/path/to/my/cron_log.log" # # every 2.hours do # command "/usr/bin/some_great_command" # runner "MyModel.some_m...
true
b8db89622d584ba81a70a68bcea49765cace45ca
Ruby
davemaurer/exercism-solutions
/ruby/difference-of-squares/difference_of_squares.rb
UTF-8
352
3.40625
3
[]
no_license
class Squares < Struct.new(:number_to_calculate_up_to) def square_of_sums numbers.sum ** 2 end def sum_of_squares numbers.map { |i| i ** 2 }.sum end def difference square_of_sums - sum_of_squares end private def numbers (1..number_to_calculate_up_to) end end module Enumerable de...
true
3a4137903354a641756e0c867d01436feec09d08
Ruby
kmac02/phase-0-tracks
/databases/awesome/cataloging.rb
UTF-8
10,654
3.625
4
[]
no_license
## ******* Cataloging and Reviewing Media ********* # A database to track and store information and reviews about media: books read, movies watched, and music heard. The media may or may not be owned by the user (for example: a movie that was streamed, or an album that was heard on spotify). A user will enter data abou...
true
ce93815c9d0259da426c624da2fafe36c3f5b5ef
Ruby
vkrish199/Training
/volume.rb
UTF-8
280
3.953125
4
[]
no_license
class Cylinder PI_VAL = 3.14 def initialize(radius, height) @radius = radius @height = height end def compute_volume vol = PI_VAL * (@radius ** 2) * @height puts "Volume of the given cylinder is #{vol}" end end cylinder = Cylinder.new(10,20) cylinder.compute_volume
true
73de9c9754d4989062e6e0b3ab196c789c760b52
Ruby
MattRice12/FEE
/exercises/4thu/isogram.rb
UTF-8
329
3.625
4
[]
no_license
def isogram(string) string_arr = string.downcase.split('') str_hash = {} count = 0 string_arr.each do |let| if !str_hash[let] str_hash[let] = 1 else return "#{string}: #{false} #{count}" end count += 1 end return "#{string}: #{true} #{count}" end puts isogram('aba') puts isogra...
true
003ac1dc589cc42e3bacbf5f79ff48f89574eabd
Ruby
sp1v4k/Ruby
/the_premise_exercise.rb
UTF-8
1,253
3.96875
4
[]
no_license
require "pry" class ProgrammingLanguage attr_accessor :name, :age, :type def initialize(name, age, type) @name = name @age = age @type = type end end class List attr_reader :list_language def to_list(list_language) list_language.each do |pl| puts "Name: #{pl.name} Age: #{pl.age} Typ...
true
5ce5582f27bbb823071d06aa7cb98ccb1de7d720
Ruby
hayamiz/volvox
/lib/tasks/gdoc_import.rake
UTF-8
2,163
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- require 'kconv' require 'csv' namespace :db do desc "Import data from csv file exported from GDoc" task :gdoc_import => [:migrate] do raise ArgumentError.new("set FILE as /path/to/gdoc.csv") unless ENV['FILE'] user = User.find_by_email("info@hayamin.com") if user puts "==...
true
32ed010b9fec2d9056d9e932ee83a858e3c45d09
Ruby
SixArm/experimentalruby
/sudoku4.rb
UTF-8
2,433
3.734375
4
[]
no_license
#########refactored sudoku ############### class Game def initialize(gamematrix) @rows=gamematrix.clone @start=gamematrix @cols=@rows.transpose end def findnils #puts "finding the nils" sleep 0.1 nilspaces=[] for g in (0..@cols.length-1) for p in (0..@...
true
0f7584236d993a8025b593eb84d863c6ad53126d
Ruby
RobertDober/lab42_nested_hash
/lib/lab42/nhash/class_methods.rb
UTF-8
1,598
3.015625
3
[ "MIT" ]
permissive
require_relative 'enum' require 'yaml' module Lab42 class NHash module ClassMethods def from_sources *sources __from_sources__(sources) end def from_sources_with_indifferent_access *sources __from_sources__(sources, indifferent_access: true ) end def from_v...
true
96e7c4e967e65ced70cef25287a86a2518a4301f
Ruby
ravenusmc/ruby_adven
/rock.rb
UTF-8
1,463
4.125
4
[]
no_license
#Rock Paper Sciccors game. def main puts "Welcome to Paper, Rock Scissors" human end #Human selects their weapon def human puts "Please select what you want to use" puts "*********************************" puts "1. Rock" puts "2. Scissors" puts "3. Paper" puts "What is your choice?" choice = get...
true
546b246a67e68e9756b1988f7c4cc769f0d3bbbc
Ruby
Euticus/module-one-final-project-ButtDial
/app/user_location.rb
UTF-8
852
2.9375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class UserLocation attr_reader :ip_stack_url attr_accessor :region_name, :city, :latitude, :longitude def initialize @ip_stack_url = "http://api.ipstack.com/check?access_key=5f2a1d39e29e3e253b04526e7c603795&fields=ip,region_name,city,%20latitude,longitude" end def set_location_by_ip ...
true
3d4b41cb25725830bce648ad989e5ee6e689e5d9
Ruby
taw/project-euler
/euler_209.rb
UTF-8
2,356
3.28125
3
[]
no_license
#!/usr/bin/env ruby1.9 def bits(&blk) (0..1).each(&blk) end class TwoSatGraph def initialize @components = [] end def add_component(a,b) @components.each{|xs| if xs[-1] == a xs << b return elsif xs[-1] == b xs << a return elsif xs[0] == a xs...
true
d2a328623d027e28bc1d85f88216d53c6c328905
Ruby
drnic/bosh-bootstrap
/lib/bosh/providers/base_provider.rb
UTF-8
1,455
2.671875
3
[ "MIT" ]
permissive
# Copyright (c) 2012-2013 Stark & Wayne, LLC module Bosh; module Providers; end; end class Bosh::Providers::BaseProvider attr_reader :fog_compute def initialize(fog_compute) @fog_compute = fog_compute end def create_key_pair(key_pair_name) fog_compute.key_pairs.create(:name => key_pair_name) end ...
true
1205c3c737b9a3f8a986ece6de79509d2aa417ad
Ruby
Exupery/pvpleaderboard
/bin/icon_check.rb
UTF-8
1,328
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require "pg" BASE_PATH = "public/images/" ICONS = "icons/" CLASSES = "classes/" RACES = "races/" TABLES = [ "specs", "talents", "pvp_talents" ] db = PG.connect(ENV["POSTGRESQL_DEV_URL"]) $has_missing = false ## Check if `icon_file` exists def check(icon_name, icon_file) if !(File.exist?(icon_f...
true
0a0a0c14d4fa36caf26154277155cbc0cf69d074
Ruby
mggbhn/kwk-l1-messy_macarena_lab_ruby-kwk-students-l1-bos-070918
/macarena.rb
UTF-8
954
3.328125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
puts "How To Do The Macarena:" puts "" # Fix The Dance Instructions Below # Every line should have one instruction using puts. # The first instruction is correct. # Step 1: GOOD puts "Step 1: Right arm out in front of you, palm facing down." puts "Step 2: Left arm out in front of you, palm facing down." # Step 2: FI...
true
4cff6c71b543c8ae1e8c96e6478472347d20fc3e
Ruby
samvera/hyrax
/app/jobs/characterize_job.rb
UTF-8
4,971
2.53125
3
[ "Apache-2.0" ]
permissive
# frozen_string_literal: true ## # a +ActiveJob+ job to process file characterization. # # the characterization process is handled by a service object, which is # configurable via {CharacterizeJob.characterization_service}. # # @example setting a custom characterization service # class MyCharacterizer # def run(...
true
dbf3a6a13325cab31d3d8567e75915ca7f5338d3
Ruby
spox/bogo
/test/specs/priority_queue_spec.rb
UTF-8
2,878
3
3
[ "Apache-2.0" ]
permissive
require_relative '../spec' describe Bogo::PriorityQueue do before do @q = Bogo::PriorityQueue.new end let(:q){ @q } describe 'Queue behavior' do it 'should return items based on cost' do q.push('worms', 10) q.push("that's", 1) q.push('what', 2) q.push('call', 6) q.push('...
true
3c20d7d302abb91447a0b33f44b56cd8f9efa2f2
Ruby
kclercin/armory
/spec/armory/data/talent_spec.rb
UTF-8
3,267
2.671875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# coding: utf-8 require 'helper' describe Armory::Data::Talent do before do @data = { tier: 6, column: 1, spec: { name: "Arms", role: "DPS", order: 0 }, # populated by talent_flatten spell: { id: 152277, nam...
true
b0746abd84bd9d5c5e2cc2ac8d2843bbf3a54964
Ruby
Twinity/PlanetWars-Client-Ruby
/src/AI.rb
UTF-8
354
2.953125
3
[]
no_license
class AI def do_turn(world) army_movement = Array.new for node in world.get_my_nodes dest = node.get_adjacents[Random.rand(node.get_adjacents.length)] move[:source] = node.get_source move[:destination] = dest move[:armyCount] = node.get_army_count / 2 army_movement.push move ...
true
7a258eddbab7cc017d014e031629995ea8c00c58
Ruby
sousk/flow
/app/models/entry.rb
UTF-8
1,652
2.6875
3
[]
no_license
require 'will_paginate/finders/base' require "uri" class Entry include Mongoid::Document include Mongoid::Timestamps field :title field :slug field :body field :published_at, :type => DateTime validates_presence_of :title, :body # will-paginate include WillPaginate::Finders::Base cattr_r...
true
2b9262783c47efa7eda7f8d6912d4da051ca6f46
Ruby
bannio/bulldog
/spec/models/contact_spec.rb
UTF-8
3,106
2.53125
3
[ "MIT" ]
permissive
require 'rails_helper' describe Contact do before do @attr = { name: "Mr Contact", email: "mc@example.com", message: "Here is my message", mail_list: '1' } end it "is valid with valid attributes" do expect(Contact.new(@attr)).to be_valid end it "validates presence of nam...
true
f953a7dffd92c62f0889e52ab73e1e4da5338aaa
Ruby
chrmsan/battle_app
/spec/game_spec.rb
UTF-8
1,032
3.25
3
[]
no_license
require 'spec_helper' describe Game do subject(:game) {described_class.new(pikachu, bulbasaur) } #instantiates a game object let(:pikachu) { double :player } # instatiates a player object? let(:bulbasaur) { double :player } # instatiates a player object? describe '#attack' do it 'inflict damage to player who...
true
8a7a22f161441703cf5c74658d664b4c301c2b14
Ruby
criosmartinez/ics_bc_s18
/week4/ch10/shuffle.rb
UTF-8
564
3.484375
3
[]
no_license
def shuffle some_array recursive_shuffle some_array, [] end def recursive_shuffle sorted_array, shuffled_order if shuffled_order.length == sorted_array.length shuffled_array = [] for idx in 0...shuffled_order.length shuffled_array.push sorted_array[shuffled_order[idx]] end puts shuffled_array ...
true
5b1ae1b9472e8d3b8dbe6c1b5592e331349fd68a
Ruby
davidenglishmusic/apples_and_oranges
/spec/apples_and_oranges_spec.rb
UTF-8
4,425
2.53125
3
[ "MIT" ]
permissive
require 'apples_and_oranges' require 'capybara' require 'capybara-screenshot' require 'capybara/rspec' require 'capybara/poltergeist' Capybara.configure do |config| config.default_driver = :poltergeist config.javascript_driver = :poltergeist end RSpec.describe ApplesAndOranges do include Capybara::DSL Struct...
true
e242b382d277f7b636b47506de8c926d502ab3c0
Ruby
neocities/neocities
/models/simple_cache.rb
UTF-8
455
2.984375
3
[ "BSD-2-Clause" ]
permissive
require 'thread' require 'time' module SimpleCache @cache = {} @semaphore = Mutex.new class << self def store(name, value, timeout=30) @semaphore.synchronize { @cache[name] = {value: value, expires_at: Time.now+timeout} } value end def get(name) @cache[name][:value] ...
true
3bb2c01ebf8244f0ab491674164dd6f8d6f6adf5
Ruby
kxkyll/PhoneBook
/app/models/address.rb
UTF-8
471
2.59375
3
[]
no_license
class Address < ActiveRecord::Base attr_accessible :number, :postcode, :street, :destination, :city has_many :inhabitants has_many :people, :through => :inhabitants validates_presence_of :street, :postcode, :city validates_numericality_of :postcode validates_length_of :postcode, :within => 5..10, :too_long...
true
25d1bcea30137e91d6431f94b3ff026547dc4e37
Ruby
Romandsom/Thinknetica
/Lesson_1/ideal_weight.rb
UTF-8
252
3.625
4
[]
no_license
puts 'What is your name?' name = gets.chomp puts 'What is your height?' height = gets.chomp.to_f ideal_weight = (height - 110) * 1.15 if ideal_weight < 0 puts 'Your weight is perfect' else puts "Your perfect weight is #{ideal_weight}, #{name}" end
true
816732a53a21526c242f038e4625e72f92ff81b8
Ruby
raymh2002/Ruby
/Code_with_Ruby/video169_intro_to_blocks.rb
UTF-8
123
3.265625
3
[]
no_license
colors = ["Red", "Purple", "Green", "Blue"] statements = colors.map {|color| "#{color} is a great color"} puts statements
true
648d07fa68264a6f671ec318a3f4f68aa10e7bb1
Ruby
pocari/algorithm
/chap3/q_3_7.rb
UTF-8
284
3.40625
3
[]
no_license
def read_str gets.chomp end def solve(s, acc=[], &b) if s == "" b.call acc.map(&:to_i) else 1.upto(s.size) do |i| val = s[0..(i-1)] solve(s[i..-1], acc + [val], &b) end end end s = read_str sum = 0 solve(s) do |expr| sum += expr.sum end puts sum
true
bc9543757fac3c785a2f20ec1470f09def9450d8
Ruby
toucan-stan/Intro-to-Programming-Companion-Workbook
/Int_Quiz_2/int_2.1.rb
UTF-8
595
3.71875
4
[]
no_license
#Tealeaf Introduction to Programming, Companion Workbook #Intermediate Quiz 2, Question 1 #Given the munsters hash below munsters = { "Herman" => { "age" => 32, "gender" => "male" }, "Lily" => { "age" => 30, "gender" => "female" }, "Grandpa" => { "age" => 402, "gender" => "male" }, "Eddie" => { "age" => 1...
true
1fb648a9236640bf66aa8bc8800b4e362190b7da
Ruby
tosiaki/expense_tracker
/app/api.rb
UTF-8
1,388
2.671875
3
[]
no_license
require 'sinatra/base' require 'json' require 'ox' require_relative 'ledger' require_relative 'adapters' module ExpenseTracker class API < Sinatra::Base def initialize(ledger: Ledger.new) @ledger = ledger super() end post '/expenses' do if request.media_type == 'text/xml' data_...
true
cf398f0ff3c7c474231208cb64b35605085246b0
Ruby
enspirit/predicate
/spec/predicate/test_attr_split.rb
UTF-8
1,489
2.515625
3
[ "MIT" ]
permissive
require 'spec_helper' class Predicate describe Predicate, "attr_split" do let(:p){ Predicate } subject{ pred.attr_split } context "on tautology" do let(:pred){ p.tautology } it{ should eq({}) } end context "on contradiction" do let(:pred){ p.contradiction } it{ should ...
true
9942d50cb7829a79d98f8ee1504c6b4af107a426
Ruby
tsuyoshi-7863/zero-ruby-practice
/chapter4.rb
UTF-8
837
3.90625
4
[]
no_license
# 4-1 # 問1 p ["コーヒー", "カフェラテ"] # 4-2 # 問2 drinks = ["コーヒー", "カフェラテ", "モカ"] # 問3 drinks = ["コーヒー", "カフェラテ", "モカ"] puts drinks[1] # 問4 drinks = ["コーヒー", "カフェラテ", "モカ"] puts drinks.first puts drinks.last # 4-3 # 問5 p ["コーヒー", "カフェラテ"].push("モカ") # 問6 p [2, 3].unshift(1) # 問7 p [1, 2] + [3, 4] # 4-4 # 問8 drinks = ["ティーラテ",...
true
2d8765590091399f462782ba3db69421f3a2f5d8
Ruby
dannybarrientos/learningruby
/sobrecargametodo.rb
UTF-8
622
3.71875
4
[]
no_license
class Terricola attr_accessor :nombre def initialize(nombre) @nombre = nombre end def saludar puts "Hola soy #{nombre} y soy un #{self.class}" end end class Ingeniero < Terricola end class Anminal < Terricola def saludar puts "Hola Soy un #{self.class} #{n...
true
553db0a2ae1c0d8062148cae2c0669d4e8d4844d
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/raindrops/6c39ad407dbb4009a160bc50cd7022df.rb
UTF-8
311
3.203125
3
[]
no_license
class Raindrops RAINDROP = { 3 => "Pling", 5 => "Plang", 7 => "Plong" } def self.convert(num) raindrops = "" RAINDROP.each do |prime_num, drop| raindrops += drop if num % prime_num == 0 end if raindrops.empty? "#{num}" else raindrops end end end
true
e367e1fcd34b75b16f358e80c6565182396c9b22
Ruby
seamusabshere/lock_method
/lib/lock_method.rb
UTF-8
3,160
2.8125
3
[]
no_license
require 'thread' require 'active_support' require 'active_support/version' if ::ActiveSupport::VERSION::MAJOR >= 3 require 'active_support/core_ext' end require 'lock_method/config' require 'lock_method/lock' require 'lock_method/default_storage_client' # See the README.rdoc for more info! module LockMethod # Th...
true
b3af6bc81f92e79e97ff39ec3a199f1b0b7b0f25
Ruby
kev-kev/ruby-enumerables-hash-practice-emoticon-translator-lab-nyc04-seng-ft-021720
/lib/translator.rb
UTF-8
722
3.296875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'yaml' require 'pp' def load_library(path) file = YAML.load_file(path) result = {'get_meaning' => {}, 'get_emoticon' => {}} file.each{ |meaning, emoticon_arr| result['get_meaning'][emoticon_arr[1]] = meaning result['get_emoticon'][emoticon_arr[0]] = emoticon_arr[1] } result end def get_japan...
true
fa4208d7762c1ec45850df672e26eac76ef74da5
Ruby
luanalvesdaniel/qaninja-enjoeat-cucumber
/features/step_definitions/restaurantes_steps.rb
UTF-8
571
2.59375
3
[]
no_license
Dado("que temos os seguintes restaurantes") do |table| @restaurant_data = table.hashes end Quando("acesso a lista de restaurantes") do visit '/restaurants' end Então("devo ler todos os restaurantes desta lista") do restaurants = all('.restaurant-item') @restaurant_data.each_with_index do |value, index| ...
true
60b2c0ebbc7d13b838f58e3f6aa21d8897a268d9
Ruby
mvelk/knights_travails
/knight.rb
UTF-8
1,744
3.640625
4
[]
no_license
require_relative 'treenode' require 'set' require 'byebug' class KnightPathFinder OFFSETS = [[2,1],[2,-1],[1,2],[1,-2],[-2,1],[-2,-1],[-1,2],[-1,-2]] def self.valid_moves(pos) #returns list of valid positions knight can reach from current position row, col = pos valid_moves = [] OFFSETS.each do |...
true
4009b660d985014bb0e764df8e7614706e73b57d
Ruby
Coolnesss/coffee-api
/config/initializers/float.rb
UTF-8
61
2.5625
3
[ "Apache-2.0" ]
permissive
class Float def round05 (self*2).round / 2.0 end end
true
57a7076ffa5247b313025644bb7411a6833a5405
Ruby
mjfreshyfresh/icar
/model/lib/scene.rb
UTF-8
1,295
2.71875
3
[]
no_license
class Scene include DataMapper::Resource require File.join("#{File.expand_path(File.dirname(__FILE__))}", 'speaker.rb') require File.join("#{File.expand_path(File.dirname(__FILE__))}", 'line.rb') property :id, Serial property :title, String has n, :lines attr_accessor :stopped attr_accessor :speak...
true
430822d1b38fde33874bfc0b309683a4141d0c98
Ruby
gonz/monkeylearn-ruby
/lib/monkeylearn/extractors.rb
UTF-8
1,301
2.59375
3
[ "MIT" ]
permissive
require 'monkeylearn/requests' module Monkeylearn class << self def extractors return Extractors end end module Extractors class << self include Monkeylearn::Requests def build_endpoint(*args) File.join('extractors', *args) + '/' end def validate_batch_size(ba...
true
55f5d4aaf62c4ddf9bb306b51860adabfc16bab1
Ruby
theHeadTy/yield-and-blocks-online-web-sp-000
/lib/hello.rb
UTF-8
265
3.953125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def hello_t(names) if block_given? arr = [] names.each do |name| yield(name) end else puts "Hey! No block was given!" end end hello_t(["Tim", "Tom", "Jim"]) { |n| puts n } hello_t(["Ali", "Jasmine", "Persephone"]) { |n| puts n.upcase }
true
5b525cbbd59b9c9970942844eb06b699b77329bd
Ruby
RBIII/park_free
/app/models/vote.rb
UTF-8
595
2.59375
3
[]
no_license
class Vote < ActiveRecord::Base belongs_to :user belongs_to :voteable, polymorphic: true validates :user_id, presence: true validates :value, inclusion: {in: [-1, 0, 1]} def upvote(user, review) if value == 1 update_attributes(value: 0) else update_attributes(value: 1) end end d...
true
7b21714b312ef4533d29653e4c29bccd0724c738
Ruby
marcoafilho/lua-compiler
/scanner.rb
UTF-8
13,446
3.09375
3
[]
no_license
require "token" class Scanner STD_ERR_MESSAGE = "Invalid argument '.chr' on line: .line_number" MALFORMED_STRING = "Malformed string on line: .line_number" attr_reader :file attr_accessor :eof, :line_info, :tokens def initialize(file_name) @file = File.open(file_name, "r+") @line_info = { :line...
true
fbbd1b43068cf5d1f844ba723af7fc3bb6851184
Ruby
zellfrey/collections_practice-london-web-121018
/collections_practice.rb
UTF-8
685
3.96875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def sort_array_asc(array) array.sort! end def sort_array_desc(array) array.sort! {|x,y| y <=> x } end def sort_array_char_count(array) array.sort! {|x,y| x.length <=> y.length } end def swap_elements(array) array[1], array[2] = array[2], array[1] array end def reverse_array(array) array.reverse! en...
true
f3d3485eb5857df986c231bcfb5ecb9548a555e3
Ruby
hx/dvd-library
/lib/xml_importer.rb
UTF-8
282
2.53125
3
[]
no_license
module XmlImporter @importers = {} def self.setup(klass, &block) @importers[klass] ||= Importer.new(klass, block) def klass.from_xml *args XmlImporter.import self, *args end end def self.import(klass, *args) @importers[klass].import *args end end
true
6caf057c2ae768fd70c56c0c44033e48465e4226
Ruby
gellieb/workspace
/workspace_2/cp1/2-2a-calc.rb
UTF-8
411
3.359375
3
[]
no_license
# These exercises are excerpted from Chris Pine's excellent book called 'Learn to Program.'' # Read it at https://pine.fm/LearnToProgram/ # Buy it at http://pragprog.com/book/ltp2/learn-to-program # Write a program that tells you the following: # Hours in a year. How many hours are in a year? # Minutes in a deca...
true
2acbac788f3cc7e6f49fabe95800e94bc83c59e6
Ruby
tirthajyoti-ghosh/repl.it-solutions
/1.1_lists.rb
UTF-8
800
4.15625
4
[]
no_license
class Node attr_accessor :value, :next_node def initialize(value, next_node = nil) @value = value @next_node = next_node end end class LinkedList #setup head and tail def initialize @head = nil @tail = nil end def add(number) new_node = Node.new(number) if @head.nil? ...
true
dc23f4a1e1c6bc2369856b98e4149846bd00266b
Ruby
khjs534/leetcodes
/palindrome_number/palindrome_number_sol.rb
UTF-8
114
3.375
3
[]
no_license
# @param {Integer} x # @return {Boolean} def is_palindrome(x) string = x.to_s string == string.reverse end
true
ebfbe0914161eea7aa97d88d0b19baf3357b4f0e
Ruby
hakatashi/sig-web-04
/app/controllers/hello_controller.rb
UTF-8
447
2.78125
3
[]
no_license
class HelloController < ApplicationController def show @message = 'Hello, World!' end def show_days render action: 'days' end def calc_days @year = params[:year].to_i @month = params[:month].to_i @day = params[:day].to_i date = Date.new @year, @month, @day days = %w{日 月 火 水 木 金 ...
true
d63dde8a7abd836b813ce8e1023e7da6f30fb579
Ruby
chef/chef
/lib/chef/chef_fs/file_system/repository/directory.rb
UTF-8
5,147
2.609375
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# # Author:: John Keiser (<jkeiser@chef.io>) # Copyright:: Copyright (c) Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # htt...
true
cdd0f2f837865c687228f7d3827c2d86f5b8b6ee
Ruby
brennovich/ruby-swagger
/lib/ruby-swagger/data/headers.rb
UTF-8
1,103
2.953125
3
[ "Apache-2.0", "MIT" ]
permissive
require 'ruby-swagger/object' require 'ruby-swagger/data/header' module Swagger::Data class Headers < Swagger::Object # https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#headersObject def initialize @headers = {} end def self.parse(headers) return nil unless headers ...
true
6ea4c4851ea26342facb8e7fc19d6b5d8a78e5bd
Ruby
dche/rcl
/lib/opencl/operand/operand.rb
UTF-8
7,695
2.890625
3
[ "MIT" ]
permissive
# encoding: utf-8 module OpenCL # An Operand object is a typed Buffer that has a program associated with it. class Operand < Buffer class << self def inherited(cls) @libraries ||= [] @libraries.each do |lib| cls.use lib end end # Makes a Library to be usabl...
true
231a6414744916b04f366a8588f48341b733694e
Ruby
forrestgrant/xtide-ruby
/lib/xtide-ruby/location.rb
UTF-8
6,328
2.640625
3
[ "MIT" ]
permissive
module Tide class LocationNotFoundException < StandardError end class Location require 'nokogiri' require 'geocoder' attr_accessor :name, :lat, :lng, :country, :time_zone, :restriction, :loc_type, :reference, :distance, :units def initialize(params = {}) params.each do |i,v| sel...
true
6dd508e47751d07bb7b06407b4b351eae3a671a7
Ruby
randomorganizer/BackEndDevelopment
/100/lesson_1/learn_to_program/classes.rb
UTF-8
1,322
3.96875
4
[]
no_license
# require_relative 'english_number' class Integer def to_eng if self == 5 english = 'five' else english = 'fifty-eight' end english end end # I'd better test on a couple of numbers... puts 5.to_eng puts 58.to_eng class OrangeTree def initialize @height = 10 @age = 1 @...
true
093b52a954577fc9d6f0602d18f33958f82b4e96
Ruby
cynipe/mog
/lib/mog/error.rb
UTF-8
743
2.65625
3
[]
no_license
module Mog class Error < StandardError def self.from_response(response) status = response[:status].to_i if klass = case status when 400 then Mog::BadRequest when 404 then Mog::NotFound when 400..499 then Mog::ClientError ...
true
01579abd44fbbf463c90ac1394a4879a0c235a0f
Ruby
ardes/pre-github-rails-plugins
/deprecated/with_pulse/asym_crypt/lib/asym_crypt.rb
UTF-8
3,944
3.390625
3
[]
no_license
require 'openssl' require 'base64' # Wrapper for OpenSSL to asymetrically (en/de)crypt arbitrarily large objects # # Also see ActiveRecord::AsymCrypt for easy encryption of active record fields. # # Use AsymCrypt.create_keys, or AsymCrypt.create_key_files to create a public/private key # pair. # # Keys are of type Asy...
true
7440de7421a24adfe2a970b1781c8bd823137ed3
Ruby
cyhe/RubyNote
/CommandLine.rb
UTF-8
975
4.125
4
[ "Apache-2.0" ]
permissive
# ruby中使用ARGV这个ruby预定义好的数组来获取从命令行传递过来的数据,数组ARGV中的元素,就是命令行中的指定脚本 字符串参数 puts "第 1 个参数: #{ARGV[0]}" puts "第 2 个参数: #{ARGV[1]}" puts "第 3 个参数: #{ARGV[2]}" # ruby CommandLine.ruby 1st 2nd 3rd # 第 1 个参数: 1st # 第 2 个参数: 2nd # 第 3 个参数: 3rd # 使用数组ARGV后,程序用到的数据就不必写在代码中.同时,抽取数据,保存数据等普通的数据操作对于ARGV都是适用的 name = ARGV[0] print "hell...
true
e2a33f23151d0f0284e43f7996f5b50694025a65
Ruby
pablobfonseca/exercism-solutions
/ruby/resistor-color-duo/resistor_color_duo.rb
UTF-8
250
2.84375
3
[]
no_license
class ResistorColorDuo RESISTORS = %w[ black brown red orange yellow green blue violet grey white ] def self.value(colors) "#{RESISTORS.index(colors[0])}#{RESISTORS.index(colors[1])}".to_i end end
true
0f222ee27fdfaed36f998b2fb925f0f2bb466cb3
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/proverb/ca1ec4902d7947e8937265d6b97d3875.rb
UTF-8
749
3.1875
3
[]
no_license
class Proverb attr_reader :chain def initialize(*chain) @chain = chain end def to_s proverb = '' each_sentence do |sentence| proverb += sentence end proverb end private def each_sentence each_word do |cause, effect| yield "For want of a #{cause} the #{effect} was los...
true
2419dd844062c4e716b7a10d764726e9ce5ef6dc
Ruby
bebekim/Ruby
/string.rb
UTF-8
134
3.1875
3
[]
no_license
var1 = 2 var2 = '5' puts var1 + var2.to_i puts '5 is my favorite number'.to_i puts 'who asked you about 5 or whatever'.to_i puts ''
true
6fbc76b50786ccea0e68497657e6c9e0d417c7d7
Ruby
devops001/ethereum
/scripts/parse_geth_log.rb
UTF-8
2,790
3.03125
3
[ "MIT" ]
permissive
require 'time' # I0616 21:14:39.121334 3343 worker.go:257] 🔨 Mined block (#620235 / da29cdec). Wait 5 blocks for confirmation # I0616 21:25:56.923166 3343 worker.go:257] 🔨 Mined stale block (#620878 / aeafff65). # I0616 21:28:03.203243 3343 worker.go:364] 🔨 🔗 Mined 5 blocks back: block #620886 # I0616...
true
ee80fec47b4c313abf7279dea3bf877b947f54f4
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/binary-search-tree/33f2611d79a14459b0a1f27e49ef48db.rb
UTF-8
819
3.25
3
[]
no_license
class Bst attr_reader :data @@array = [] def initialize(data, side = :r) @data = data @side = side @child = {l:nil, r:nil} end def insert(datum) if datum <= data unless left self.left = datum else left.insert(datum) end else unless right ...
true
b5ce1d21842c54f8eab41b79b7150065814708e5
Ruby
hase1031/favor-api-client
/lib/favor/api/client.rb
UTF-8
2,601
2.75
3
[ "MIT" ]
permissive
require "favor/api/client/version" require 'net/http' require 'json' module Favor module Api class RequestError < StandardError; end module Client API_ENDPOINT = 'http://widget.favor.life/api/v1' @@options = { method: 'get' } # Default search options def self....
true
c97f40dd3f023be49d3db88e7e046bec40635693
Ruby
gaga06/61_Projet_Club_Prive
/test/models/user_test.rb
UTF-8
1,204
2.8125
3
[]
no_license
require 'test_helper' class UserTest < ActiveSupport::TestCase def setup @user = User.new(first_name: 'example', last_name: 'LASTNAME', email: 'user@example.com', password: 'popopo', password_confirmation: 'popopo') end test "the truth" do assert true end test "should be valid" do asser...
true
eea30dc86267e831a86e453e72b716182b5f6992
Ruby
geekjimbo/romanos
/tdd_numerals.rb
UTF-8
444
3.109375
3
[]
no_license
require '/Users/jimmyfigueroa/code/romanos' describe "convertir numeros arabigos a romanos" do context "Los romanos no usaban el 0 (cero)" do it "convierta 0 en una hilera en vacia" do expect(convert(0)).to eq("") end end { 1 => "I", 5 => "V", 2 => "II", 3 => "III" }.each_pair ...
true
8b5d7453975d263bd80d3965160405d1327d4b29
Ruby
pcardosolei/BetESS_ruby
/Views/HistoricoView.rb
UTF-8
183
2.765625
3
[]
no_license
class HistoricoView def initialize end def toString(evento) evento.historico.equipas.each do |equipa , odd| print "#{equipa} > #{odd}" puts end end end
true
8c1eecd8c870f5799f6aabfdd589ce8a90bf8fdb
Ruby
rshiva/MyDocuments
/10-book-case/ruby1.9/samples/exttk_3.rb
UTF-8
603
2.71875
3
[]
no_license
#--- # Excerpted from "Programming Ruby", # published by The Pragmatic Bookshelf. # Copyrights apply to this code. It may not be used to create training material, # courses, books, articles, and the like. Contact us if you are in doubt. # We make no guarantees that this code is fit for any purpose. # Visit http://www...
true
388f9b9491c73d150e2727dd9df7b34d71ce230e
Ruby
Alex2334/Labs
/Лабораторная работа 6/Часть 3/function_to_solve3.rb
UTF-8
243
2.890625
3
[]
no_license
# Ruby 2.3 def integr_w_n_div(a, b, n, lambda = nil, &block) block = lambda unless lambda.nil? res = (-block.call(a) + block.call(b)) / 2.0 div = (b - a).to_f / n n.times do |i| res += block.call(a + i * div) end res * div end
true
81ee19a3252d82ae400b96ef09d91f9f9269e54a
Ruby
shooma/activeadmin_settings_cached
/lib/activeadmin_settings_cached/coercions.rb
UTF-8
1,321
2.78125
3
[ "MIT" ]
permissive
module ActiveadminSettingsCached class Coercions SIMPLE_COERCIONS = { float: :to_f, integer: :to_i, symbol: :to_sym } attr_reader :defaults, :display def initialize(defaults, display) @defaults = defaults @display = display init_methods end def cast_param...
true
a6983dce8b1a6ee3f1d87a8041f1ce2ba8d36ef8
Ruby
boumer/ruddy
/lib/ruddy/connection.rb
UTF-8
2,049
2.59375
3
[ "MIT" ]
permissive
module Ruddy class Connection attr_reader :service, :topic attr_accessor :timeout def initialize(service, topic, options = {}) @service = service @topic = topic @timeout = options.fetch(:timeout, 3000) start connect end def close @closed = true DDE.s...
true
5d024db704a2f76bd1332c1fc6ac55bbe2747137
Ruby
amarshall/coding-challenges
/vts/010-keyboard-puns/src/generate-table.rb
UTF-8
696
2.609375
3
[]
no_license
#!/usr/bin/env ruby # frozen_string_literal: true mapping = { 'A' => 'A', 'B' => 'X', 'C' => 'J', 'D' => 'E', 'E' => '.', 'F' => 'U', 'G' => 'I', 'H' => 'D', 'I' => 'C', 'J' => 'H', 'K' => 'T', 'L' => 'N', 'M' => 'M', 'N' => 'B', 'O' => 'R', 'P' => 'L', 'Q' => "'", 'R' => 'P', 'S'...
true
5b5d4efd60ad4a7a3a423f8e240a37f23533e711
Ruby
venkateshcm/deploy_couch
/lib/deploy_couch/delta_loader.rb
UTF-8
1,047
2.625
3
[]
no_license
module DeployCouch class DeltaLoader def initialize(deltas_folder) @deltas_folder = deltas_folder end def get_deltas hash = {} files = Dir["#{@deltas_folder}/*.yml"].select {|f| File.file?(f)} files.each do |file| file_name = File.basename(file) key = file_name....
true
dbd85e1c0a538ddeabd44cd86c847cba7fd1a10a
Ruby
berk-ozer/ar-exercises
/exercises/exercise_6.rb
UTF-8
766
2.9375
3
[]
no_license
require_relative '../setup' require_relative './exercise_1' require_relative './exercise_2' require_relative './exercise_3' require_relative './exercise_4' require_relative './exercise_5' puts "Exercise 6" puts "----------" # Your code goes here ... @store1.employees.create(first_name: "Khurram", last_name: "Virani",...
true
ddcf74b94b4f9ebf0e1cb267977d206550556e7c
Ruby
jacindaz/sinatra_leaderboard
/server.rb
UTF-8
3,601
3.453125
3
[]
no_license
require 'sinatra' require 'rubygems' require 'csv' require 'pry' #METHODS-------------------------------------------------------------- def load_csv(file_name) scores = [] CSV.foreach(file_name, headers: true, header_converters: :symbol) do |score| scores << score.to_hash end scores end def winning_team(...
true
ab5f8473c93fd4ffbf5d031d251d090e27b6b553
Ruby
henryaddison/text_linear
/lib/text_linear/string_tokeniser.rb
UTF-8
160
2.53125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module TextLinear module StringTokeniser class << self def tokenise(string) string.gsub(/\W/," ").downcase.split end end end end
true
db0074b6fe8e778c60f6d58b3a4e28bfcc4a6d8a
Ruby
RANDRIANTSIVOHO/RUBY
/exo_20.rb
UTF-8
211
3.140625
3
[]
no_license
puts "Salut, bienvenue dans ma super pyramide ! Combien d'étages veux-tu ?" print "> " i = gets.chomp.to_i x = # y = "#" puts "voici la pyramide :" for num in 0 ..i puts x x=x+y break if x == i end
true
cc829e39cf7edb3a7508f3a09a922b1cbd810a13
Ruby
chrisdews/my-collect-london-web-051319
/lib/my_collect.rb
UTF-8
174
3.453125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def my_collect(array) if block_given? i = 0 arr = [] while i < array.length arr << yield(array[i]) i += 1 end arr else puts "empty collection" end end
true
9074997acc04d522463c4e9d86c3177a1d96cb3d
Ruby
AdamLombard/LS-LearnToProgram
/CH7/99_bottles_of_beer.rb
UTF-8
550
4.125
4
[]
no_license
# Write a probram that prints out the lyrics to the beloved # classic, "99 Bottles of Beer on the Wall". def test_plural(num) num != 1 ? 's' : '' end def main_phrase_a(num) "#{num} bottle#{test_plural(num)} of beer" end def main_phrase_b "on the wall" end num_of_bottles = 99 while num_of_bottles > 0 puts "...
true
174a0faf03b67181182ad3c65249e7655b43b3a5
Ruby
tjarratt/adventofcode-2019
/intcode/lib/instruction/writeoutput.rb
UTF-8
426
2.609375
3
[]
no_license
require 'instruction/base' module Instruction class WriteOutput < Base def initialize(input, eval_index, relative_base_setter, writer) @writer = writer super(input, eval_index, relative_base_setter) end def evaluate(program) value = program[index_for(1, program)] @writer << value...
true
3f3eece44f69848d937a64400e12ca148b5e76fd
Ruby
ELYPSIARECORDS/grid-number
/test/grid_test.rb
UTF-8
6,599
2.671875
3
[ "MIT" ]
permissive
require "test_helper" class GRidTest < Minitest::Test def setup @id_scheme = "A1" @issuer_code = "2425G" @release_number = "ABC1234002" @check_character = "M" end def test_valid grid = GRid.new refute grid.valid? grid = GRid.new(:issuer_code => @issuer_code, :release_number => @rele...
true
80ceaa23de9ef4aab3f07e949fb26f301cca1d04
Ruby
matugm/exercism_solutions
/raindrops/raindrops.rb
UTF-8
308
3.03125
3
[]
no_license
require 'prime' class Raindrops def self.convert(input) mapping = { 3 => 'Pling', 5 => 'Plang', 7 => 'Plong' } factors = Prime.prime_division(input) factors.map! do |prime, _| mapping.fetch(prime, '') end output = factors.join output == "" ? input.to_s : output end end
true