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
88bb881c2ae688e970fca87244859ba742371198
Ruby
sccp2017/defective-project
/test/03_function/difference_of_squares_normal_test.rb
UTF-8
1,003
3.625
4
[]
no_license
require 'test/unit' require_relative '../../src/03_function/difference_of_squares_normal' =begin - square of sum N - (1 + 2 + 3 + ... + N)^2 - sum of squares N - (1^2 + 2^ + 3^2 + ... + N^2) - difference - (square of sum) - (sum of squares) =end class ExpressionTest < Test::Unit::TestCase def test_square_of_...
true
b35414bed1a9f2abacfc624cf07ceef277e215fb
Ruby
doolin/rpo
/ch2/date_parsing3.rb
UTF-8
217
2.8125
3
[]
no_license
#!/usr/bin/env ruby require 'date' require 'benchmark' date = "2014-05-23" time = Benchmark.realtime do 100_000.times do Date.civil(date[0,4].to_i, date[5,2].to_i, date[8,2].to_i) end end puts "%.3f" % time
true
24e97eab36261204a1741267fbc534e304c40938
Ruby
redmansal/C41100_Ruby
/6 spam rater/p6_4_priv_prot_pub/lib/main.rb
UTF-8
1,681
4.1875
4
[]
no_license
# To change this template, choose Tools | Templates # and open the template in the editor. require '../lib/dog.rb' require '../lib/cat.rb' #making a new object rover rover = Dog.new("rover", "collie",30) #this method will call because fetch is a public method rover.fetch #rollover will not call because it is a priv...
true
d09336e3db1cfce3dab43854c18e5b0992e15e0d
Ruby
pocket7878/compp
/AtCoder/abc/abc035/b.rb
UTF-8
986
3.640625
4
[]
no_license
class State attr_reader :branches def initialize(x, y) @x = x @y = y end def move(dx, dy) @x += dx @y += dy end def branches bs = [] bs << State.new(@x - 1, @y) bs << State.new(@x + 1, @y) bs << State.new(@x, @y - 1) bs << State.new(@x, @y + 1) bs end def dist...
true
3922ec8ab39fd214c92d07650810f2ba86a11515
Ruby
hailexiao/blackjack
/hand.rb
UTF-8
750
3.71875
4
[]
no_license
class Hand attr_reader :hand def initialize(owner, card_1, card_2) @owner = owner @hand = [] @hand << card_1 << card_2 puts "#{@owner} was dealt #{card_1.identity}#{card_1.suit}" puts "#{@owner} was dealt #{card_2.identity}#{card_2.suit}" end def hit(card) @hand << card puts "#{@own...
true
bde21db4b3fd4502733319dba9b1dc03ff24e31c
Ruby
digideskio/foodmoves
/vendor/plugins/flextimes/lib/flex_times.rb
UTF-8
12,165
3.25
3
[]
no_license
# FlexTimes - the plugin that gives YOU control over the datetime helpers. # # Author: Sean Cribbs # # See FlexTimes::HelperMethods::datetime_select for more information. module FlexTimes # def self.append_features(base) #:nodoc: # super # base.extend(ActiveRecordExtensions) # end module Help...
true
423612e044731da682790b38ff1c4a5feb0a3a9b
Ruby
Esgeri/decart_test_api
/lib/tasks/currency.rake
UTF-8
1,326
2.796875
3
[]
no_license
require "net/http" require "uri" require "rexml/document" namespace :currency do desc 'Сохранить курсы валют' task :save_exchange_rates => :environment do begin document document.root.elements.each do |currency| name = currency.get_text('Name') rate = currency.get_text('Value') ...
true
03855b47644c4a7986140bd78f8239b514caa070
Ruby
lubanrb/luban
/lib/luban/deployment/configuration/question.rb
UTF-8
847
2.609375
3
[ "MIT" ]
permissive
module Luban module Deployment class Configuration class Question attr_reader :prompt, :default def initialize(default:, prompt: nil, echo: true) @default = default @echo = echo @prompt = "#{prompt.to_s}: " unless prompt.nil? end def echo?; @ec...
true
cc3049789fe161a4c2d5c9fb39946396372e8e9c
Ruby
alex-szeto/ruby-oo-complex-objects-school-domain-nyc-web-010620
/lib/school.rb
UTF-8
419
3.640625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# code here! class School attr_accessor :roster def initialize(empty) @roster = Hash.new([]) end def add_student(student, grade) @roster[grade] += [student] end def grade(grade) output = [] @roster.each{ |key, value| if key == grade output << roster[key] en...
true
6e0a74aa66069702ff39c0db62eef1c0ec782869
Ruby
ericmanzi/alt_routes_mapmatching
/rcm_scripts/route_coverage_service.rb
UTF-8
7,359
2.59375
3
[]
no_license
class RouteCoverageService attr_accessor :trip, :route, :trip_segment_ids, :segment_ids, :coverage def initialize(route) @route = route @segment_ids = @route.segments.map{|r| r.osm_way_id} end def execute if !@route.nil? extract_trip_features calculate_intersection_distance puts "[#{@...
true
b163e4612121f43c24916e25757d2dfcf21efb44
Ruby
loganyu/leetcode
/problems/009_palindrome_number.rb
UTF-8
849
4.09375
4
[]
no_license
=begin Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Ex...
true
53c5404cc3ad39bc347e43dd3af472436d954b32
Ruby
shelbycer/machine-translator-challenge
/spec/srt_formatter_spec.rb
UTF-8
1,739
3.125
3
[]
no_license
require 'spec_helper' describe SrtFormatter do describe '#extract_elements' do it 'pulls each element out of the srt file and puts them in an array of hashes' do expect(SrtFormatter.extract_elements("data/sriracha_trailer_en.srt")[0]).to eq({"text"=>">> It's kind of funny because I mean when it comes dow...
true
049bbd7622ea0af15f54df4a5aba84a5cf7d9522
Ruby
Dahie/metro
/lib/metro/models/ui/tmx/tile_layer.rb
UTF-8
1,802
2.6875
3
[ "MIT" ]
permissive
module Metro module UI class TileLayer < ::Metro::Model property :rotation attr_accessor :map attr_accessor :layer attr_accessor :tilesets attr_accessor :viewport def data layer.data end def x viewport.left end def y viewport....
true
daebcc953782a7a8d6784fff0291911d9d2e5daa
Ruby
Midori-Gift/ruby-book
/chapter-6/seiki03.rb
UTF-8
626
3.1875
3
[]
no_license
text = <<TEXT クープバゲットのパンは美味しかった。 今日はクープ バゲットさんに行きました。 クープ バゲットのパンは最高。 ジャムおじさんのパン、ジャムが入ってた。 また行きたいです。クープ・バゲット。 クープ・バケットのパン、売り切れだった(><) おれも行きたいっち!クーポベッケト! TEXT # 改行(\n)←されるまでの文章を一つの検索対象とし、grepによって検索対象を決める一文 search = text.split(/\n/).grep(/クープ.?バ[ケゲ]ット/) puts search
true
0beae2967c03c69d96c135213507c539ec19815c
Ruby
MaddieLewis/excuse-engine
/db/seeds.rb
UTF-8
4,608
2.546875
3
[]
no_license
puts "destroying all seeds ..." LocationExcuse.destroy_all CreativeExcuse.destroy_all SavedExcuse.destroy_all User.destroy_all puts "seeding users ..." user1 = User.create!(first_name: "Janie", last_name: "Amero", username: 'jamero', email: 'janie.amero@gmail.com', password: "janieamero") user2 = User.create!(first_na...
true
416f88efc1bc487447faa1e7101ba15564d8c4c7
Ruby
Tsubasaman0/ruby_practice
/lib/7/eql.rb
UTF-8
421
3.046875
3
[]
no_license
a = 'Unkoman' b = 'Unkoman' p a.equal?(b) p 1 == 1.0 h = { 1 => 'Top', 1.0 => 'Float'} p h[1] p h[1.0] p 1.eql?(1.0) a = 'japan' b = 'japan' p a.eql?(b) c = 1 d = 1.0 p c.eql?(d) p c.hash p d.hash text = '03-1234-4567' case text when /^\d{3}-\d{4*$/ puts '郵便番号です' when /^\d{4}\/\d{1,2}\/\d{1,2}$/ ...
true
306d529a9f3bcacb77ee788fbb835ff810f5ed00
Ruby
Brett-Bonnet/learn_ruby
/06_timer/timer.rb
UTF-8
218
3.1875
3
[]
no_license
class Timer attr_accessor :seconds def initialize @seconds = 0 end def time_string hours = @seconds / 3600 remainder = @seconds % (60 * 60) sprintf("%02d:%02d:%02d", hours, remainder/60, remainder%60) end end
true
c0e4a475a7c50127f3e900604e84dbe087e5a4ea
Ruby
aaronwtan/Intro-to-Ruby-Exercises
/More_Stuff/Ex_2.rb
UTF-8
275
4.0625
4
[]
no_license
# What will the following program print to the screen? What will it return? def execute(&block) block end execute { puts "Hello from inside the execute method!" } # Nothing because the block is never called in the execute method using the .call method. # => Proc object
true
cfbcc857fe3de4592c4119b0403fc97aa1dfa094
Ruby
edwardchalstrey1/pdist
/lib/pdist.rb
UTF-8
5,262
3.640625
4
[ "MIT" ]
permissive
#encoding: utf-8 class PDist require 'diff/lcs' # Returns array of values for each object's deviation in permutation, from original def self.distances(original, permutation) indices = [] indices << original.map{|x| permutation.index(x)} # indices of original values in permutation indices << Array(0..(origina...
true
0c81e48a0197c40b83415c143134a5af4340a6f5
Ruby
daphsta/toy_robot
/lib/toy_robot/turn_left.rb
UTF-8
588
3.21875
3
[ "MIT" ]
permissive
module ToyRobot class TurnLeft attr_reader :position def initialize(position:) @position = position end def call return Position.new( x: position.x, y: position.y, direction: '') if invalid_direction? Position.new( x: position.x, y: position...
true
019b4eeca52a99b750858a36349618c14124b7d3
Ruby
d0minicw0ng/ruby-chesses
/chess/player.rb
UTF-8
268
3.25
3
[]
no_license
require_relative 'board' require 'debugger' class Player attr_accessor :color, :opponent_color def initialize(color) puts "What is your name, Soldier?" @name = gets.chomp @color = color @opponent_color = @color == :red ? :white : :red end end
true
b6fdf3da6f6d48fb461bac0e4e2b07d1769e76c7
Ruby
cghsystems/grabber
/spec/transform/csv_format_cleaner_spec.rb
UTF-8
746
2.5625
3
[]
no_license
require 'spec_helper' describe Transform::CsvFormatCleaner do context '.clean' do it 'should clean sort code with no following quote' do expect(subject.clean("'99-99-99")).to eql("99-99-99") end it 'should clean sort code with no starting quote' do expect(subject.clean("99-99-99'")).to eql("...
true
10e7e9d1967bfca4923929e0839b0304a695aff8
Ruby
AliceArmstrong/tic-tac-toe
/lib/game.rb
UTF-8
1,131
3.90625
4
[]
no_license
# game board array # # current players turn, X ? marker = O : marker = X # # array.map { [2] == " " ? [2] X : } # # # arr = [" ", " "] # # winning combinations? class Game attr_reader :board_arr, :player def initialize @board_arr = [" "," "," ", " "," "," ", " "," "," "] ...
true
1c0cfdb6c999b5d3fe6395497a2a61b97265869d
Ruby
honjintang/Oyster-Card
/lib/journey_log.rb
UTF-8
630
2.890625
3
[]
no_license
class JourneyLog attr_reader :journey_class, :current_journey, :journeys def initialize(journey_class) @journey_class = journey_class @journeys = [] end def start @current_journey = journey_class.new end def add_start(station) current_journey.add_start(station) end def finish(statio...
true
8c67c2ddaa0804d866cb3dc3096da980fc61e59a
Ruby
pludlum/app_academy_projects
/w1d3/Recursion.rb
UTF-8
2,969
3.65625
4
[]
no_license
def range (arg1, arg2) return [] if arg2 < arg1 return [] if arg2 == arg1 range(arg1, arg2-1) + [arg2-1] end def recursive_sum(arr) return 0 if arr.empty? arr.first + recursive_sum(arr[1...arr.length]) end def iterative(arr) arr.reduce(:+) end def expo(base,power) return 1 if power == 0 return base...
true
edc6dc7b3ea5578622c15e59aca1b3cb5f10d118
Ruby
jmcolella/algorithms-data-structures
/algorithms/ruby/merge_sort.rb
UTF-8
958
4.28125
4
[ "MIT" ]
permissive
# method that recursively divides input array into smaller chunks # in order to sort with sort_and_merge method def merge_sort( arr ) return arr if arr.length == 1 mid = arr.length / 2 arr1 = merge_sort( arr[0...mid] ) arr2 = merge_sort( arr[mid..-1] ) sort_and_merge( arr1, arr2 ) end # method that sorts ...
true
15c770ae6fb708b2f246c9e4368a18d43dd0b7cd
Ruby
maxmind/minfraud-api-ruby
/lib/minfraud/model/geoip2_location.rb
UTF-8
703
2.609375
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'maxmind/geoip2/record/location' module Minfraud module Model # Model of the GeoIP2 location information, including the local time. class GeoIP2Location < MaxMind::GeoIP2::Record::Location # The date and time of the transaction in the time zone associated with ...
true
55ecd9efc343b971096493de13150f7222f6b85c
Ruby
jverbosky/isbn
/reference/sandbox - refactoring are_characters_valid method.rb
UTF-8
576
3.59375
4
[]
no_license
#isbn = "0471958697" isbn = "0-321@14653-0" def are_characters_valid?(isbn) isbn_array = isbn.split("") valid_characters = "0123456789 -xX".split("") invalid_character_count = 0 isbn_array.each do |character| unless valid_characters.include?(character) then invalid_character_count += 1; break end end i...
true
23e1cf586b9d815c3cccddb68e1a1dc84e9e2ed0
Ruby
Seraff/blasto
/bin/scripts/codon_usage_by_positions.rb
UTF-8
1,334
2.6875
3
[]
no_license
#!/usr/bin/env ruby require_relative '../lib.rb' params = Slop.parse do |o| o.banner = "Get codon usage by positions, beginning from the right side" o.string '-fasta', '(required) fasta file' o.string '-gff', '(required) gff file' o.on '-h', '--help', 'Print options' do puts o exit end end assure_pa...
true
16caeb2941d6919d751cd4fa94ee2a690e214770
Ruby
LtSquigs/mini_racer
/lib/mini_racer.rb
UTF-8
3,044
2.5625
3
[ "MIT" ]
permissive
require "mini_racer/version" require "mini_racer_extension" require "thread" module MiniRacer class EvalError < StandardError; end class ScriptTerminatedError < EvalError; end class ParseError < EvalError; end class SnapshotError < StandardError; end class RuntimeError < EvalError def initialize(messag...
true
0a2805953360e6fd3f40a0d2ff99d79636b5f2cd
Ruby
EpicDream/shopelia
/lib/url_monetizer.rb
UTF-8
335
2.828125
3
[]
no_license
class UrlMonetizer CACHE = "url_monetizer_cache" def initialize @redis = Redis.new end def get(canonized_url) original_url = @redis.hget(CACHE, canonized_url) end def set(canonized_url, original_url) @redis.hset(CACHE, canonized_url, original_url) end def del url @redis.hdel(CACHE, ...
true
458d3222503a73b970aca7341b7ea46a4c8f62cc
Ruby
miaubiz/rBuggery
/lib/buggery/winerror.rb
UTF-8
953
2.71875
3
[]
no_license
# Quick helper to get formatted errors using GetLastError # # Author: Ben Nagy # Copyright: Copyright (c) Ben Nagy, 2006-2012. # License: The MIT License # (See http://www.opensource.org/licenses/mit-license.php for details.) require 'rubygems' require 'ffi' module WinError MAX_PATH=260 FORMAT_MESSA...
true
97c5f02479ab68d003a03dddf309da0bc74bb924
Ruby
Isangidien/sep-assignments
/01-data-structures/07-graphs/film_hash.rb
UTF-8
2,104
2.859375
3
[]
no_license
def fill_film_hash(actor_hash) film_hash = Hash.new film_hash["Apollo 13"] = [ "Kevin Bacon", "Tom Hanks", "Bill Paxton", "Gary Sinise" ] film_hash["Boogie Nights"] = [ "Julianne Moore", "Mark Wahlberg", "Burt Reynolds", "Heather Graham" ] film_hash["Edge of Tomorrow"] = [ "Tom Cruise", "Emily Blunt", "Bill Paxton"...
true
42780d039f027ee28dd6d5cc242a26854f40f33a
Ruby
ntorres91/Metis-Prework
/assign4_mixitup2.rb
UTF-8
271
3.671875
4
[]
no_license
puts 'Hello, What is your favorite number?' number = gets.chomp puts 'Your favorite number is ' + number + ' ?' puts "Shouldn't your favorite number be larger?" #var1 = number #var2 = '1' #puts var1 + var2.to_i puts "How about your pick plus one #{ number} + 1"
true
1779b124c09c3eaa3b38d3f3e657ebf2f62fc0c9
Ruby
lsegal/easy_audio
/examples/shepard.rb
UTF-8
531
3.03125
3
[ "BSD-3-Clause" ]
permissive
require_relative '../lib/easy_audio' def render(freq: 220.0, time: 1.0, sample_rate: 44100) (sample_rate * time).to_i.times.map do |n| 4.times.to_a.map do |i| 12.times.to_a.map do |j| fij = freq * 2 ** i * 2 ** (j / 12.0) a = Math.exp(-(Math.log2(fij / freq) ** 2) / 0.5) a * Math.si...
true
93d12b846995ffd750d73e734047f6626981e895
Ruby
bedwardsphoto/triangle-classification-v-000
/lib/triangle.rb
UTF-8
506
3.484375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Triangle def initialize(a,b,c) @a=a @b=b @c=c end def kind valid_triangle? if @a==@b && @b==@c && @a>0 return :equilateral elsif (@a==@b || @a==@c || @b==@c) && (@a>0 && @b>0) return :isosceles elsif @a!=@b && @a!=@c && @c!=@b return :scalene else raise TriangleError end end def val...
true
be92e7d0701afae9561e1c67632342035fbf30d6
Ruby
GGMU1986/AA-Homework
/W3D4/diy_adts.rb
UTF-8
1,228
3.828125
4
[]
no_license
class Stack def initialize() # create ivar to store stack here! @arr = [] end def push(el) # adds an element to the stack @arr << el end def pop # removes one element from the stack @arr.pop end def peek # returns, but doesn't remove, the to...
true
794a6ed1a5d85be19d7ea83547ded7830d4a4870
Ruby
odineiramone/semaphoreci-getting-started-with-rspec
/spec/string_calculator_spec.rb
UTF-8
3,246
3.4375
3
[]
no_license
require 'spec_helper' require 'string_calculator' describe StringCalculator do describe '.add' do context 'given an empty string' do it { expect(StringCalculator.add('')).to eql 0 } end context "given '10'" do it { expect(StringCalculator.add('10')).to eql 10 } end context 'two numb...
true
ad937c88dfe8b7ad462648e715a17e09f8c1e8a3
Ruby
timgrc/rails-krowd
/app/services/yammer/get_last_message_from_group.rb
UTF-8
212
2.53125
3
[]
no_license
class Yammer::GetLastMessageFromGroup def initialize(user, group_id) @yam = user @group_id = group_id end def call Yammer::GetMessagesFromGroup.new(@yam, @group_id).call.first end end
true
b16ce3820d302ff99ba6fd650761784ba45b96fa
Ruby
taf2/curb
/tests/bug_instance_post_differs_from_class_post.rb
UTF-8
1,450
2.796875
3
[ "Ruby" ]
permissive
# From Vlad Jebelev: # # - Second thing - I think you just probably didn't have the time to update # instance methods yet but when I POST with a reusal of a previous curl # instance, it doesnt' work for me, e.g. when I create a curl previously and # then issue: # # c.http_post(login_url, *fields) # # instead ...
true
985609c825635ac81b6560ff83b31b657863120b
Ruby
tgmcclen/teamworker
/app/models/absence.rb
UTF-8
482
2.625
3
[]
no_license
class Absence < ActiveRecord::Base belongs_to :supply attr_accessible :start_date, :end_date, :supply_id # TODO absence is not calculated properly when supply is part time (i.e. fte ratio is not 1). i.e. if they are 0.6 fte ratio and they only have # one day off in a week then it would calculate (0.6 * 5) -...
true
9dc78635f11f486c1779d8444619c5ed7c928865
Ruby
cowens87/battleship
/test/cell_test.rb
UTF-8
1,642
3.109375
3
[]
no_license
require "minitest/autorun" require "minitest/pride" require "./lib/ship" require './lib/cell' class Test < Minitest::Test def test_it_exists cell = Cell.new("B4") assert_instance_of Cell, cell end def test_attributes cell = Cell.new("B4") assert_equal "B4", cell.coordinate end def test_sh...
true
37e7bedc62843062f452f42a7cea3892bbdc6256
Ruby
bodgix/wiki-top-words
/lib/top_words_printer.rb
UTF-8
1,093
3.265625
3
[]
no_license
# frozen_string_literal: true # Top level encapsulating module for the project module WikiTopWords # Print the TOP N words module TopWordsPrinter def self.print_results(wiki_page, how_many) words_rev_order = wiki_page.sorted_elements(&:downcase).reverse print_header(wiki_page, how_many) merg...
true
c424444c3f5cda8549d55140c5bbb0f983b056ee
Ruby
tallkeith/OO-t3
/game.rb
UTF-8
748
3.8125
4
[]
no_license
class Game def initialize(board, player, computer) @board = board @player = player @computer = computer end def play(board, player, computer) greeting(board, player, computer) player.make_move(board) board.player_move(board, player) end def greeting(board, player, computer) puts puts "Welcom...
true
59fdf9458c243cd1a761115c360b4938386f61ce
Ruby
pbodsk/ruby-sodukusolver
/soduku.rb
UTF-8
5,329
3.71875
4
[ "MIT" ]
permissive
module Soduku class Puzzle def initialize(lines) #TODO: respond to array soduku_string = lines.dup #strip whitespace characters soduku_string.gsub!(/\s/, "") #check size raise Invalid, "The grid has the wrong size" unless soduku_string.size == 81 ...
true
856dc6cb1441c92805556c186e78ded4ca08c062
Ruby
zencephalon/chess-console-rb
/lib/board.rb
UTF-8
1,311
3.4375
3
[ "MIT" ]
permissive
class Board def initialize(args) board_str = args.fetch(:board_str) @parser = args.fetch(:parser) @board = {} board_str ? parse!(board_str) : setup_standard_chess! end def parse!(board_str) lines = board_str.split("\n") @height = lines.size @width = lines.first.size lines.each_wit...
true
0804bf18909bfa603afafe19ef6f1fb4bf9b81ed
Ruby
kev-kev/ruby-enumerables-cartoon-collections-lab-nyc04-seng-ft-021720
/cartoon_collections.rb
UTF-8
584
3.46875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(names_arr) names_w_nums = {} names_arr.each_with_index{ |name, i| names_w_nums[i+1] = name } p names_w_nums end def summon_captain_planet(call_array) call_array.collect{ |call| call.capitalize + "!" } end def long_planeteer_calls(call_array) call_array.any?{ |call| call.l...
true
805b397840cd7cf57b1b4024fa5b11e751cccf32
Ruby
mpm/taxger
/src/node/conditional_node.rb
UTF-8
688
2.8125
3
[ "MIT" ]
permissive
class ConditionalNode < Node def initialize(element) @cond_expr = element.attr('expr') @then = SourceNode.new(element.xpath('./THEN/*')) @else = SourceNode.new(element.xpath('./ELSE/*')) super() end def attach_else(elements) if @else.lines.count > 0 raise "Cannot attach another ELSE blo...
true
d6f439dc91730b5fa6565319a6f9e78aa7cf3010
Ruby
5-21maimai/ProjectEuler
/Problem17.rb
UTF-8
1,335
4.21875
4
[]
no_license
def countWord(max) count = 0 for num in 1..max do count = count + createWord(num).length end return count end def createWord(num) englishList = { 0 => "", 1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five", 6 => "six", 7 => "seven", 8 => "eight", 9 => "nine", 10 => "ten", 11 =>...
true
84cb22c5f261ec2bae24461c10ed71963badf4bd
Ruby
ohtacaesar/Chartify
/lib/highcharts/series.rb
UTF-8
1,173
3.203125
3
[]
no_license
module Highcharts class Series attr_reader :name, :data, :data_type, :max, :min, :average def initialize(name, data) @name = name @type = :line @data = data @visible = true @data_type = nil @max = nil @min = nil @average = nil ...
true
1d5349faa97dd3d9b3db94b46d648cd8949754d8
Ruby
taw/opal-d3
/lib/opal/d3/color.rb
UTF-8
1,724
2.8125
3
[]
no_license
module D3 class Color include D3::Native attr_reader :native alias_native :to_s, :toString alias_native_new :brighter alias_native_new :darker alias_native :displayable?, :displayable alias_native_new :rgb # Various subsets of these are valid depending on color - maybe we should prope...
true
eb08273d2e3d564fbbe4663623f6dee5635c0e9c
Ruby
x24padua22/x24_test_project
/x24_blog/app/models/user.rb
UTF-8
975
2.640625
3
[]
no_license
class User < ActiveRecord::Base attr_accessible :name, :email_address, :password email_regex = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]+)\z/i has_many :blogs, :through => :owners has_many :posts, :dependent => :destroy has_many :messages, :dependent => :destroy has_many :owners, :dependent => :destroy validates :...
true
f7602520bdbe18ff7d67c917d30b9e233c8827a6
Ruby
mohammadsultani/Ruby-Exercises
/exam_2.rb
UTF-8
610
4.15625
4
[]
no_license
# You will write a method reverse(word) that takes in a String # The method returns the word with its letters in reverse order # You may not use the String#reverse or String#reverse! method def reverse(word) revers_word = "" i = word.length x = 0 a = [] loop do a.push(word[x]) x +=1 b...
true
2e6db1c40a8ab0cf7aee54e77a0debbb0df230bc
Ruby
BankToTheFuture/identity_mind_ruby
/spec/identity_mind/params_spec.rb
UTF-8
1,878
2.71875
3
[]
no_license
require 'ostruct' RSpec.describe IdentityMind::Params do before(:all) do IdentityMind.configure { |config| config.param_length_limit = 6 } end after(:all) do IdentityMind.load_default_configuration end describe '#[]' do context 'when passing hash' do it 'creates new Params object' do ...
true
c8d670f6c852ef49ca15902b23a74d2298c9f44b
Ruby
youta777/AtCoder
/ABC/ABC171/b.rb
UTF-8
730
3.171875
3
[]
no_license
=begin date:2020.7.17 fri result:WA 問題URL:https://atcoder.jp/contests/abc171/tasks/abc171_b 結果URL:https://atcoder.jp/contests/abc171/submissions/15277094 =end # 自分の解答 ------------------------ a = gets.chomp.split(' ')[1] prices = gets.chomp.split(' ').to_a.map!(&:to_i) buy_list = [] a.to_i.times do bu...
true
f76b1052c852e109ab1cac216b67dfc0c017fb54
Ruby
JK8283/BEWD
/MTA.rb
UTF-8
2,987
4.375
4
[]
no_license
## The program takes the line and stop that a user is getting on at and the line and stop ## that user is getting off at and prints the total number of stops for the trip. ## There are 3 subway lines: ## The N line has the following stops: Times Square, 34th, 28th, 23rd, Union Square, and 8th ## The L line has the fo...
true
519c4b0b1eb073c4bf20ed5e470ec7be263837c4
Ruby
brendanr425/Launch-School-Programming-Foundations
/lesson_4/palindrome_substrings.rb
UTF-8
347
3.609375
4
[]
no_license
def palindrome?(string) string.reverse == string && string.length > 1 end def palindrome_substrings(str) substring = [] first = 0 last = 0 while first < str.length while last < str.length substring << str[first, last] if is_palindrome(str[first, last]) last += 1 end first += 1 las...
true
9431e8edf9077e040e849a0fac3bc6aed58c8b1d
Ruby
spmno/PC2
/iris_door.rb
UTF-8
809
2.859375
3
[]
no_license
require_relative 'door' class IrisDoor < Door def initialize(serial) @id, @serial_port = "\x31", serial @thread = Thread.new { read_func } @read_buf = '' MXLogger.debug 'IrisDoor init' end def open MXLogger.debug self.class.to_s + '--' + __method__.to_s command = make_command @id, "\x00"...
true
1e4083ebebcf986a6a431e05d9e06f4088228441
Ruby
noguchi999/shotcrawl
/app/testcase/status.rb
UTF-8
485
2.625
3
[]
no_license
# coding: utf-8 module Shotcrawl module Testcase class Status STATUS = { normal: nil, success: nil, warning: nil, error: nil } def initialize(status) if STATUS.key? status.to_sym @status = status.to_sym else rai...
true
0ad7a2b4f9d5fa77857f87066f9b97f12726c3b5
Ruby
vendetta546/codewars
/Ruby/7KYU/Office1.rb
UTF-8
177
3.15625
3
[]
no_license
def outed(meet, boss) result = 0 meet.each {|person,rate| result += person.to_s==boss ? 2 * rate : rate } result/meet.length <= 5 ? "Get Out Now!" : "Nice Work Champ!" end
true
588faf5c9aa68fab3f71a468e963904b1329933d
Ruby
kristianmandrup/rpg_model
/spec/add_game/game_spec.rb
UTF-8
1,385
2.703125
3
[]
no_license
require 'spec_helper' module RPG describe "Game" do describe "#start" do before(:each) do @game = Game.new 'my game' @world = World.new 'my world' end it "should add a world" do @game.worlds.should_receive(:add).with(@world) @game.start ...
true
40a2bcc3c7ed2e5c40011db7849e6b972fce8b7c
Ruby
nergdnvlt-zz/day_hike
/spec/models/trip_spec.rb
UTF-8
1,483
2.640625
3
[]
no_license
require 'rails_helper' RSpec.describe Trip, type: :model do describe 'Relationships' do it { should have_many(:trails) } it { should have_many(:trip_trails) } end describe 'instance methods' do it 'calculates total length' do trip = Trip.create(name: 'bobs trail', start_date: Time.now, end_dat...
true
f4874082f6503adea5153e2380eb7db1d5abeed9
Ruby
burrahey/anagram-detector-v-000
/lib/anagram.rb
UTF-8
319
3.828125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Your code goes here! class Anagram attr_accessor :word def initialize(word) @word = word end def match(word_list) word_list.select do |word| anagram?(word) end end def anagram?(word) ana = @word.length == word.length && @word.chars.all? {|c| word.include?(c)} ana end end
true
161754cbd399b5ab5d09d4759beacdadcbac6c3a
Ruby
rikuya6/Practice_Ruby
/AOJ/AOJ10023.rb
UTF-8
207
3.640625
4
[]
no_license
def shuffle(cards, h) cards += cards.slice!(0, h) cards end while ((cards = gets.chomp) != '-') m = gets.to_i for i in 0...m do h = gets.to_i cards = shuffle cards, h end puts cards end
true
cbc3d911327b33a275d5b45ff184b7bcdc3ba0c0
Ruby
zoodles/vocab
/lib/vocab/extractor/base.rb
UTF-8
2,854
2.59375
3
[ "MIT" ]
permissive
module Vocab module Extractor class Base class << self def extract( diff_path = nil, full_path = nil ) all_strings = current_strings all_plurals = current_plurals updated_strings = diff( previous_strings, all_strings ) updated_plurals = diff( previous_plurals...
true
cc3313c9d3e30fe70acfae4d7b98d7dbe4c78eb9
Ruby
patrick-gleeson/threadmill
/app/models/stock_effect.rb
UTF-8
359
2.828125
3
[]
no_license
# A stock effect models how serving a given item reduces a # given stock. E.g. an espresso might have a stock effect # of reducing coffee beans by 25 grams. class StockEffect < ActiveRecord::Base belongs_to :stock belongs_to :item validates :change, numericality: { greater_than: 0 } def zero_change? chang...
true
f56d3720405752b7484a1eebbb86bda91533d883
Ruby
JetechNY/nyc-web-102620
/19-intro-to-javascript/run.rb
UTF-8
275
3.875
4
[]
no_license
require 'pry' raffy = {name: "Raffy", age: 9} puts raffy[:name] arr = [1,2,3,4] def is_it_even(arr_argument) if arr_argument.length.even? puts "It is even." else puts "It is odd." end end is_it_even(arr) arr.each do |num| puts num * 2 end binding.pry
true
9755679f3c63fe0811cda3648fdae1be160afc9f
Ruby
ChicoState/DesignAndMaintenance
/design-patterns/Decorator-ruby/decorator_design_pattern.rb
UTF-8
378
3.125
3
[ "MIT" ]
permissive
require_relative 'basic_computer.rb' require_relative 'gaming_computer.rb' require_relative 'laptop.rb' class DecoratorDesignPattern customized_pc = GamingComputer.new(Laptop.new(BasicComputer.new)) puts "Asus Rog Zephrus G14" puts "Parts: #{customized_pc.parts}" puts "Cost = $#{customized_pc.cost}" puts "wh...
true
bfd6f60bdc0a3e16500fa7da0f690f531619ac28
Ruby
joeygibson/adventofcode2020
/day12/day12.rb
UTF-8
2,155
3.921875
4
[ "MIT" ]
permissive
#!/usr/bin/env ruby # # The ship starts by facing east. Only the L and R actions change # the direction the ship is facing. (That is, if the ship is # facing east and the next instruction is N10, the ship would # move north 10 units, but would still move east if the following action were F.) if ARGV.length != 1 puts...
true
aa94a9e73a1a869117bc288d1e2675b868c250c7
Ruby
didww/ruby-api-library
/lib/kayako_client/http/http_client.rb
UTF-8
3,513
2.53125
3
[ "BSD-2-Clause-Views" ]
permissive
####################################################################### # # Kayako Ruby REST API library # _____________________________________________________________________ # # @author Andriy Lesyuk # # @package KayakoClient # @copyright Copyright (c) 2011-2015, Kayako # @license FreeBSD # @link ...
true
9d25fb19affc795d533f88e94a982f7a548d3328
Ruby
vpsfreecz/haveapi
/examples/servers/ruby/activerecord_auth/lib/api/resources/user.rb
UTF-8
3,030
2.578125
3
[]
no_license
module API::Resources class User < HaveAPI::Resource desc 'Manage users' # Associate this resource with ActiveRecord model. # This will let us return AR models and HaveAPI will know how to work # with them, i.e. extract parameters. HaveAPI will also fetch validators # from the model and add t...
true
20413151ec0ad0fb3f7d66cee90b6430f30286e9
Ruby
Demosthenes466/number_summary
/calculate.rb
UTF-8
642
2.734375
3
[]
no_license
require_relative 'number_summary' a = (1..6).map { |i| i } # print a, "\n" file = File.open("data.csv", 'r') file.each_line do |line| num_array = line.split(",") # print num_array puts print "Number Summary", "\n" print "==============""\n" print NumberSummary.min(num_array), "\n" print NumberSummary.max(...
true
d8e6273352ada5fab8dca78f1b1ebf65f9fe2c21
Ruby
amantripathi/bot_save_princess
/bot_saves_princess/lib/bot_save_princess.rb
UTF-8
951
3.4375
3
[]
no_license
class BotSavePrincess attr_reader :size, :grid def initialize(size, grid) @size = size @grid = grid end def route_to_princess moves = [] princess_cord = princess_position mario_cord = mario_position cols = princess_cord[0] - mario_cord[0] rows = princess_cord[1] - mario_cord[1] ...
true
e4a442a6b84f078a6f0e958a23b93519640c33d0
Ruby
7imon7ays/checkers
/Player.rb
UTF-8
938
3.578125
4
[]
no_license
class WrongFormatError < NoMethodError end class Player attr_reader :color def initialize(color) @color = color end end class HumanPlayer < Player def get_input puts "Input a sequence of move coordinates".colorize(:white) command = gets.chomp if command == "save" return :save el...
true
9714d2f833d681f8efa7df3e6b50f8a0dfe44a5a
Ruby
sebyx07/dotabayrekt
/spec/steam_entities/dota_player_spec.rb
UTF-8
2,093
2.625
3
[]
no_license
require 'spec_helper' require 'dota_steam/steam_entities/dota_player' require 'json' describe 'DotaSteam::SteamEntities::DotaPlayer' do let(:player_hash_history) do content = File.read('./json_responses/getMatchHistory.json') json = JSON.parse(content) json['result']['matches'][0]['players'][0] end ...
true
f2611c81213cde88af93b55206904ba408606fff
Ruby
CreceLibre/sales-on
/app/models/cart.rb
UTF-8
1,429
2.953125
3
[]
no_license
require 'securerandom' require 'json' class Cart attr_accessor :items, :id def initialize(id) @id = id || SecureRandom.uuid items = R.get(@id) @items = if items JSON.parse(items) else [] end end def ad...
true
4982b68fe421aa3cf52f36adf27c9d6b215f658a
Ruby
vannak1/algorithm
/subset_sum.rb
UTF-8
408
4
4
[]
no_license
# Given an array of numbers arr, determine whether arr can be divided into two subsets for which the sum of elements in both subsets is the same. # # Example # # For arr = [3, 5, 16, 8], the output should be # subsetSum(arr) = true. # # It is possible to partition this array into two subsets that have a sum of 16: [16]...
true
674fc8fd63f0736fe0c64a75efd1e47aac838981
Ruby
cjcjameson/phase_0_unit_2
/week_5/2_die/my_solution.rb
UTF-8
1,408
4.0625
4
[]
no_license
# U2.W5: Die Class 2: Arbitrary Symbols # I worked on this challenge [by myself, with: ]. # 2. Pseudocode # Input: # Output: # Steps: # 3. Initial Solution class Die def initialize(sides) #Expecting an array if sides.length <= 0 raise ArgumentError.new("Must have a positive number of sides on the ...
true
88e1e05c3d8ffee4d70b4fafb668f934ac4d4317
Ruby
hipe/hipe-core
/lib/hipe-core/struct/open-struct-write-once-extension.rb
UTF-8
3,474
2.859375
3
[ "MIT" ]
permissive
require 'ostruct' module Hipe module OpenStructWriteOnceExtension # # Warning - we are considering making this an extension for a plain old hash instead, # and then using it internally in an OrderedHash and/or OpenStruct # # With some data structures it is useful to assert that certain elements o...
true
40c4e79e7a87d78d161840e2e5ec65d4a1591374
Ruby
asalves07/exercism.io
/word-count/word_count.rb
UTF-8
297
3.6875
4
[]
no_license
class Phrase REGEX = /\s+|,|\n|:|\./ def initialize(phrase) @words = phrase.downcase.split(REGEX).filter { |word| !word.empty? } end def word_count counts = {} @words.each do |word| counts.key?(word) ? counts[word] += 1 : counts[word] = 1 end counts end end
true
63e6ce1817a8679c467d81f4147cbe128843c4f2
Ruby
jjuarez/life_simulator
/lib/life_simulator/world.rb
UTF-8
2,974
3.375
3
[]
no_license
module LifeSimulator class World ## # The basic constructor of our world def initialize(config) Configurator.load(config) @n = Configurator[:n] @m = Configurator[:m] @tiles = Array.new(@n) @tiles.map! { Array.new(@m) } @vegetarian_move_probability = Configurator...
true
cbda9dacef1fda2edad7e909d967f1b4c13cd067
Ruby
fidothe/draught
/lib/draught/point_builder.rb
UTF-8
446
2.75
3
[ "MIT" ]
permissive
require_relative './point' module Draught class PointBuilder attr_reader :world, :tolerance, :zero def initialize(world) @world = world @tolerance = world.tolerance @zero = Point.new(0, 0, world) end def new(x, y) Point.new(x, y, world) end def build(x, y) Poi...
true
16b62b03d51e80b78f630d42efea2633f7510e4b
Ruby
urbantumbleweed/urbantumbleweed
/w01/d02/Jesse_Sessler/bouncer.rb
UTF-8
392
3.6875
4
[]
no_license
print 'What is your age? ' age = gets.to_i if age < 18 puts 'Get out!' elsif age < 20 puts 'Come in but no wristband for you!' else puts 'Come on in, drink, do whatever you want!' end # ================================================== print 'What is your name? ' name = gets.chomp unless name == 'hari' puts...
true
7f81212ceeef6f38ec6d58b0a725d23e597db165
Ruby
micah-jaffe/aA-homeworks
/W4D3/auth_homework/app/models/user.rb
UTF-8
841
2.5625
3
[]
no_license
class User < ApplicationRecord validates :username, :session_token, presence: true, uniqueness: true validates :password_digest, presence: true, message: "can't be blank" validates :password, length: { minimum: 6, allow_nil: true } before_validation :ensure_session_token def self.find_by_credentials(username...
true
81fc93a4e7acfcf1213e767c3b3a1793ab5231a7
Ruby
jasonkaskel/projecteuler
/46/solution.rb
UTF-8
1,051
4.03125
4
[]
no_license
# It was proposed by Christian Goldbach that every odd composite number can be written # as the sum of a prime and twice a square. # 9 = 7 + 2×1 ** 2 # 15 = 7 + 2×2 ** 2 # 21 = 3 + 2×3 ** 2 # 25 = 7 + 2×3 ** 2 # 27 = 19 + 2×2 ** 2 # 33 = 31 + 2×1 ** 2 # It turns out that the conjecture was false. # What is the smal...
true
2dce9d209b98029af3ed428d96cfcf5ebacdc2f8
Ruby
journeywithrails/boss
/lib/last_obelus/open_struct/extensions.rb
UTF-8
1,199
2.671875
3
[]
no_license
# RADAR: scope -- have to use ::OpenStruct here not just OpenStruct, because otherwise is_a etc. will think you mean LastObelus::OpenStruct module LastObelus module OpenStruct module Extensions def to_h @table end def to_json(options) end def [](key) ke...
true
d11f5e3d5477fcbb381246ee25d254d4a76b3868
Ruby
mystioreo/hotel
/lib/reservation.rb
UTF-8
1,550
3.34375
3
[]
no_license
require 'date' class Reservation attr_reader :checkin_date, :checkout_date, :price, :room_number, :reservation_id, :customer def initialize(checkin_date, checkout_date, room, customer, price_per_night = 200) check_date_range(checkin_date, checkout_date) @checkin_date = checkin_date @checkout_date = c...
true
1239c0501d943a37f65a9295042e57ecd1b97995
Ruby
bskaggs/link_text_topic_model
/src/main/ruby/phoenix/disambiguators/random_walk_disambiguator.rb
UTF-8
3,395
2.5625
3
[]
no_license
#!/usr/bin/env ruby require 'rubygems' require 'phoenix/wiki/wiki' require 'phoenix/evaluation_framework' require 'set' require 'peach' require 'phoenix/graph/random_walk' class RandomWalkSimilarity < EvaluationFramework def initialize(options) super(options) @wiki = Wiki.new(options.root) out_links_file ...
true
75ac60a4d8e6327dd35c5cd43aba97ca9ab32936
Ruby
Ewan88/Museum
/models/exhibit.rb
UTF-8
1,788
3.140625
3
[]
no_license
require_relative '../db/sql_runner' require 'pry' class Exhibit attr_reader :id attr_accessor :artist_id, :category def initialize (values) @id = values['id'].to_i if values['id'] @artist_id = values['artist_id'].to_i @category = values['category'] end def save sql = "INSERT INTO exhibits ...
true
1bb898fec56ba4075bffae7d5f977f2e08f976ed
Ruby
marioatpb/advent_of_code
/2017/01/captch.rb
UTF-8
735
3.328125
3
[]
no_license
require 'set' require '../lib/grid.rb' require '../lib/ring.rb' module Advent class Captch attr_accessor :debug attr_reader :digits def initialize(input) @debug = false @digits = input.chomp.chars.map(&:to_i) end def debug! @debug = true end def matches_next_digi...
true
b78ead443f9adde8fedd2ba4118f194c8bf17ee4
Ruby
JBeaussart/rails-mister-cocktail
/db/seeds.rb
UTF-8
632
3.09375
3
[]
no_license
puts 'destroy ingredients && Cocktails' Ingredient.destroy_all # Cocktail.destroy_all puts 'Creating ingredient && Cocktail...' lemon = { name: 'Lemon' } ice = { name: 'Ice' } mint = { name: 'Lint leaves' } # pina_colada = { name: 'Pina colada' } # sex_on_the_beach = { name: 'Sex on the beach' } # malibu = { name: 'M...
true
9d89fc1ebff4cfb798e516c9d9e9ccf09057fa06
Ruby
gabecadiz/jungle-rails
/spec/models/user_spec.rb
UTF-8
2,312
2.578125
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do describe 'Validations' do User.destroy_all subject = User.new({ password: "password", password_confirmation: "password", first_name: "Gabe", last_name: "Cadiz", email: "gabetest@email.com" }) subject.save it...
true
e64a6ba63e1d566112dca1fd63be17b61a160892
Ruby
emilyrsiegel/partime_ruby
/week_6/week6.rb
UTF-8
1,331
3.359375
3
[]
no_license
# module ParseCSV # def load_file(file) # File.open(file) # end # end # end # new_csv = ParseCSV.new module Xml #<--name spacing, both classes use Document which is okay because of module; module used for multiple inherentence class Document def do_something puts "I'm doing Something with a XML document" ...
true
979b01c6f3aebb003874373ccd52f20c40f8f7e2
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/grains/6f1ab82e32af46089b07df09675ac8e2.rb
UTF-8
275
3.390625
3
[]
no_license
class Grains attr_accessor :chessboard def initialize @chessboard = (2..64).to_a.each_with_object({1 => 1}) {|square, hsh| hsh[square] = hsh[square-1]*2 } end def square(space) chessboard[space] end def total chessboard.values.reduce(:+) end end
true
743ef14ed2bebd51f3b3aa84ced1b0767158dff0
Ruby
alechoey/trLOLing
/collection/file_factory/file_factory.rb
UTF-8
270
2.609375
3
[]
no_license
module FileFactory class FileFactory include Enumerable def next_filename raise NotImplementedError, 'FileFactory is an abstract type and must be extended' end def next_filepath File.join(@dir, next_filename) end end end
true
b27474579145c4c4b3cb721e70d72a5470f4e50e
Ruby
vwb/ActiveRecordLite
/lib/03_associatable.rb
UTF-8
2,356
2.796875
3
[]
no_license
require_relative '02_searchable' require 'active_support/inflector' # Phase IIIa class AssocOptions attr_accessor( :foreign_key, :class_name, :primary_key ) def model_class @class_name.constantize end def table_name model_class::table_name end end class BelongsToOptions < AssocOption...
true
9563afd14622c28aaad9d479832a04323d796f6a
Ruby
mindplace/console_games
/TicTacToe/board.rb
UTF-8
2,075
3.40625
3
[ "MIT" ]
permissive
class Board attr_reader :grid def initialize(grid=[[nil, nil, nil], [nil, nil, nil], [nil, nil, nil]]) @grid = grid end def [](row, column) @grid[row][column] end def []=(row, column, symbol) @grid[row][column] = symbol end def place_mark(position, symbol) self[*position] =...
true
4546bde98b52df2f2e5136e3f1cca6dec147c99f
Ruby
HerrWagner1680/business_project
/app.rb
UTF-8
601
2.578125
3
[]
no_license
require "sinatra" require "mandrill" post "/sent" do m = Mandrill::API.new message = { :subject=> "Hello from the Mandrill API", :from_name=> "#{params[:first_name]} #{params[:last_name]} #{params[:email]}", :text=>"#{params[:codingclass]}", :to=>[ { :email=> "swagner2001@mac.com", :name=> "HerrWa...
true
fdac11ca90d3046e42930cdc1f5f2c57558b2e3b
Ruby
mv/caelum-rr75
/spec/support/matchers/calcula.rb
UTF-8
448
3.03125
3
[]
no_license
module CarroSpec class Calcula def initialize(comissao) @comissao = comissao end def matches?(block) bloco.call == @comissao end def failure_message_for_should "valor da comissão não está igual: #{@comissao}" end def failure_message_for_should_not "valor da co...
true
8a6fdc965e655f5bfb0231edae3012076e697e07
Ruby
janjindra/PDA-Static_and_Dynamic_Task_A
/card_game_specs.rb
UTF-8
683
2.6875
3
[]
no_license
require('minitest/autorun') require('minitest/reporters') require_relative('./card_game.rb') require_relative('./card.rb') Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new class TestCardGame < MiniTest::Test def setup # @card_game = CardGame.new() @card1 = Card.new("clubs", 3) @card2 = Card.new("spad...
true