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
20d1d0cb20a2b2d2e588f8bd73d5f2751e93c66c
Ruby
jemmaissroff/ractor-sudoku
/sudoku-3.rb
UTF-8
3,533
3.328125
3
[]
no_license
class Candidate attr_accessor :ractor def initialize @ractor = Ractor.new do value = Ractor.receive loop { Ractor.yield value } end end end class Group attr_reader :candidate_ractors def initialize(candidate_ractors) @candidate_ractors = candidate_ractors Ractor.new candidate_ra...
true
d2ef3b6b216f67de46f4fa4f4f23f8cd661dc8a9
Ruby
DialBird/e_anki_dsl
/main_dsl.rb
UTF-8
929
2.578125
3
[]
no_license
# frozen_string_literal: true require 'bundler/setup' require 'active_record' require 'pry' require './schema' Dir.glob('./lib/ext/*.rb').each { |f| require f } lambda { vocabs = [] define_method :remember do |name, &block| v = Vocab.new(name: name) block.call v vocabs << v end define_method :e...
true
68785e87825a911d9c28e1d301bc4920e5845bcc
Ruby
alphagov/gsd-publish-data
/app/models/year_month.rb
UTF-8
960
3.171875
3
[]
no_license
class YearMonth class Serializer < ActiveRecord::Type::Value def type :year_month end def cast(value) value end def serialize(value) value ? value.date : nil end def deserialize(value) case value when Date YearMonth.new(value.year, value.month) ...
true
b0ea72a302155954f0462ff8b47b62e41371fd4c
Ruby
J-Y/RubyQuiz
/ruby_quiz/quiz16_sols/solutions/players/ne_stupid.rb
UTF-8
1,565
3.515625
4
[ "MIT" ]
permissive
class NeoneyeStupid < Player QUEUE = [ :scissors, :rock, :paper ] def initialize( opponent ) super @history = [] @count = 0 @lose = [] @draw = [] @win = [] end def qs QUEUE.size end def queue(i) QUEUE[i % QUEUE.size] end def chance(level, a, b) (rand(100) < level) ? a : b end def choose @c...
true
082984a9fa980a09fce2499c45e051ab8c3d1910
Ruby
vybirjan/MI-RUB-ukoly
/brainfuck/lib/bf_c_translator.rb
UTF-8
1,208
3.359375
3
[]
no_license
require_relative 'brainfuck_ast.rb' class BrainfuckCTranslator def self.to_c_source(ast) source = "" source << PROLOG element = ast tabcount = 1 while(element != nil) source << tabs(tabcount) case element when IncrementValue source << "memory[pointer]++;...
true
bf39fa9f3f26647e6764de680afa70616f691b40
Ruby
simp/pupmod-simp-simp_rsyslog
/lib/puppet/functions/simp_rsyslog/format_options.rb
UTF-8
2,084
2.84375
3
[ "Apache-2.0" ]
permissive
# Formats a passed log options hash into a form that is appropriate for an # Expression Filter-based Rsyslog 7 rule. # # @see https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/s1-basic_configuration_of_rsyslog.html Basic Configuration of Rsyslog # # @author Trevor...
true
bb61949e0058c335615d74c86b8002d4e80bf7ed
Ruby
NickLindeberg/parkween
/app/services/google_geolocation_service.rb
UTF-8
503
2.5625
3
[]
no_license
class GoogleGeolocationService def get_geolocation_coordinates get_json("/geolocation/v1/geolocate?key=#{ENV['GOOGLE_API_KEY']}")[:location] #this will return the value of location{:lat => x, :lng=>x} end private def conn Faraday.new(url:"https://www.googleapis.com") do |faraday| faraday.param...
true
d2dff1df2c6d1d090c7782197a01b99bffbb6ca2
Ruby
contiguity/playskull
/cinch-playskull/lib/cinch/plugins/skullgame.rb
UTF-8
20,566
2.65625
3
[]
no_license
require 'cinch' require 'set' require_relative 'game' $pm_users = Set.new module Cinch class Message old_reply = instance_method(:reply) define_method(:reply) do |*args| if self.channel.nil? && !$pm_users.include?(self.user.nick) self.user.send(args[0], true) else old_reply.bi...
true
381a5b64f10905808d4c866c8ea232a24717bc88
Ruby
toddzal/odin_exercises
/inheritence.rb
UTF-8
1,563
4.03125
4
[]
no_license
module Towable def tow puts "Tow machine go brrrrrr." end end class Vehicle @@vehicle_counter = 0 def initialize (year, make, color) @year = year @make = make @color = color @speed = 0 @@vehicle_counter += 1 end def calc_MPG (miles, gallons) ...
true
5edec60cf874a796f08c4aec11010861bc23c197
Ruby
pedropereira/curex
/app/entities/rate_value_entity.rb
UTF-8
543
2.6875
3
[]
no_license
# frozen_string_literal: true class RateValueEntity attr_reader :created_at attr_reader :id attr_reader :rate_id attr_reader :updated_at attr_reader :value def initialize(created_at:, id:, rate_id:, updated_at:, value:) @created_at = created_at @id = id @rate_id = rate_id @updated_at = upd...
true
d01ac05226af7e3bad4401f47c02bf3affeaf847
Ruby
julieharrow/ecomm-app
/db/seeds.rb
UTF-8
1,251
2.546875
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
true
1235bc9ac512fa99cba8c797d0fb7fc155777e18
Ruby
johnhowardroberts/launch-school-ruby-basics-exercises
/return/breakfast1.rb
UTF-8
196
3.1875
3
[]
no_license
def meal return 'Breakfast' end puts meal # Return ensures it prints # prints Breakfast even if return isn't there because method will always execute the last line within it that is executed.
true
5706f87c97d3586d241cefdd3d6ddfcef016bff4
Ruby
rinayumiho/aA-homeworks
/W4D5/solutions.rb
UTF-8
593
3.6875
4
[]
no_license
def longest_fish(arr) # O(n^2) arr.each do |ele| longest = true arr.each do |ele2| if ele2 > ele longest = false break end end return ele if longest end nil # O(nlgn) arr.sort_by! { |a, b| a.length <=> b...
true
0470072301f125b27778d536db0883748f750103
Ruby
monical75/vcloud-rest
/lib/vcloud-rest/vcloud/catalog.rb
UTF-8
4,082
2.71875
3
[ "Apache-2.0" ]
permissive
module VCloudClient class Connection ## # Fetch details about a given catalog def get_catalog(catalogId) params = { 'method' => :get, 'command' => "/catalog/#{catalogId}" } response, headers = send_request(params) description = response.css("Description").first ...
true
6ae2fef1d5356dbe0deb198ebf6a20ffc47cc855
Ruby
nathanworden/Introduction-to-Programming-with-Ruby
/05. Loops & Iterators/00.perform_again.rb
UTF-8
566
3.96875
4
[]
no_license
# perform_again.rb declining_balance = 0 puts puts "Your current declining balance is $#{declining_balance}" puts puts "Would you like to add $10 to your declining balance? Enter 'Y' or 'N'" answer = gets.chomp.downcase if answer == 'n' p declining_balance elsif loop do declining_balance += 10 puts "new...
true
2a376379ae18845689e125c5a641d8dc4bd769cc
Ruby
blambeau/veritas
/lib/veritas/attribute/date_time.rb
UTF-8
798
2.640625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# encoding: utf-8 module Veritas class Attribute # Represents a DateTime value in a relation tuple class DateTime < Object include Comparable DEFAULT_RANGE = (::DateTime.new..::DateTime::Infinity.new).freeze # The DateTime primitive # # @example # DateTime.primitive ...
true
696c2c26af8069b483760ae350aaf2e93e722698
Ruby
songgz/tumugi
/lib/tumugi/cli.rb
UTF-8
3,728
2.515625
3
[ "Apache-2.0" ]
permissive
require 'thor' require 'tumugi' require 'tumugi/command/new' module Tumugi class CLI < Thor package_name "tumugi" default_command "run_" class << self def common_options option :file, aliases: '-f', desc: 'Workflow file name', required: true option :config, aliases: '-c', desc: 'Co...
true
4c6918890d33749d5b88e51b17477439f2fb0e19
Ruby
kgoettling/intro_to_programming
/ch2_variables/ex4_name3.rb
UTF-8
320
4.21875
4
[]
no_license
# Modify name.rb again so that it stores the user's first name in a variable # then does the same for the last name and outputs both at once puts 'Hi, what\'s your first name?' first_name = gets.chomp puts 'And your last name?' last_name = gets.chomp puts "So, your full name is #{first_name} #{last_name}. Awesome!"
true
10742ec6bc3384c58093d1b891c49c32bd265a2a
Ruby
timsjoberg/circus
/lib/irc/connection.rb
UTF-8
1,446
2.890625
3
[ "Beerware", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'thread' require 'socket' require 'timeout' current_dir = File.dirname(__FILE__) require File.join(current_dir, 'parser') require File.join(current_dir, 'errors') module Circus class Connection def initialize(event_manager, config) @parser = Parser.new(event_manager) @config = config ...
true
e63b9773dcd45092a7bcd1ffe2ce47defaf0119d
Ruby
angelbotto/logvisual-api
/models/user.rb
UTF-8
1,433
2.609375
3
[]
no_license
## # User model # class User include Mongoid::Document include Mongoid::Timestamps # adds created_at and updated_at fields include BCrypt field :email, type: String field :password_hash, type: String field :verify, type: Boolean, default: false field :token, type: String, ...
true
3d56f5140b3ec925459f07d8b03e0765b00644b4
Ruby
acco/dm-salesforce
/lib/dm-salesforce/property/boolean.rb
UTF-8
391
2.59375
3
[ "MIT" ]
permissive
module DataMapper::Salesforce module Property class Boolean < ::DataMapper::Property::Integer FALSE = 0 TRUE = 1 def self.dump(value, property) case value when nil, false then FALSE else TRUE end end def self.load(value, property) [true, 1, ...
true
d09e007259548110f04a8e3942a3ebaf4eb11c9e
Ruby
daniel-lanciana/paxos-challenges
/lib/file_binary_search.rb
UTF-8
2,358
3.421875
3
[]
no_license
# frozen_string_literal: true require './lib/gift_input_parser' # Returns line of sorted file without loading everything into memory class FileBinarySearch NEWLINE_CHARACTER = "\n" MIN_LINE_LENGTH = 4 DELIMITER = ', ' def initialize(args) @file = args[:file] @parser = args[:parser] end def find(...
true
c374dc3a6c59b4864343ef36ba8264f820b58aff
Ruby
miguelrosato/101_programming_foundations
/00 Lesson 2 Small Programs/00 Small Problems Exercises/10 Medium 1/02_rotation2.rb
UTF-8
455
3.515625
4
[]
no_license
def rotate_str(str) str[1..-1] + str[0] end def rotate_rightmost_digits(num, idx) str = num.to_s (str[0..-idx - 1] + rotate_str(str[-idx..-1])).to_i end p rotate_rightmost_digits(735291, 1) # == 735291 p rotate_rightmost_digits(735291, 2) # == 735219 p rotate_rightmost_digits(735291, 3) # == 735912 p rotate_rig...
true
ca11ebd15c03826ef81ffd98d541f836b09a2557
Ruby
jazzygasper/bank_tech_test
/lib/bank_account.rb
UTF-8
421
3.25
3
[]
no_license
require_relative 'statement' class Bank_Account attr_reader :balance, :statement def initialize(statement = Statement.new) @balance = 0 @statement = statement end def deposit(amount) @balance += amount @statement.current_deposit(amount, @balance) end def withdrawal(amount) @balance ...
true
07a3eeed586f4b534f49e0bec2cb21c62aefa58f
Ruby
SalarGhotaslo/airport_challenge_own
/lib/airport.rb
UTF-8
532
3.140625
3
[]
no_license
require_relative 'weather_reporter' # frozen_string_literal: true # Creating a class airport class Airport def initialize(capacity) @capacity = capacity @planes = [] end def land(plane) raise 'Cannot land as airport is full' if full? raise 'Cannot land plane: weather is stormy' if stormy? ...
true
b3cb063bf0f791384b89781fe93a334aea93e759
Ruby
BeccaHyland/potluck
/test/potluck_test.rb
UTF-8
1,335
3.015625
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/potluck' require 'pry' class DishTest < Minitest::Test def test_it_has_a_date potluck = Potluck.new("7-13-18") assert_equal "7-13-18", potluck.date end def test_it_starts_with_an_empty_array_of_dishes potluck = Potluck.new("7-13-18"...
true
e97f2896230e3289d80583e4dedce45fad9db810
Ruby
oscarcuihang/leetcode
/ruby_solutions/191.NumberOf1Bits.rb
UTF-8
449
4.03125
4
[]
no_license
# Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). # For example, the 32-bit integer ’11' has binary representation 00000000000000000000000000001011, so the function should return 3. # @param {Integer} n, a positive integer # @return {Integ...
true
29f61926a52c0b6f8a79fcc1bb7e8e1ba44753e6
Ruby
josephine-c/Phone_number
/phone-number/phone_number.rb
UTF-8
498
3.640625
4
[]
no_license
# Get rid of white space and punctuation # Get rid of country code 1 and restrict area code to starts with a number ranging from 2-9 # Restrict length of number to 10 digits and restrict the exchange code with number from 2-9 class PhoneNumber def self.clean(phone) phone_num = phone.scan(/\d/).join ...
true
baaa4636dd72f4be3607ab9d4446386bdd25067b
Ruby
aitorlb/launch_school
/RB109/interview/exercises/easy_7/1_combine_two_lists.rb
UTF-8
1,147
4.53125
5
[ "MIT" ]
permissive
=begin Combine Two Lists Write a method that combines two Arrays passed in as arguments, and returns a new Array that contains all elements from both Array arguments, with the elements taken in alternation. You may assume that both input Arrays are non-empty, and that they have the same number of elements. Example: ...
true
8c82fa024583ed34ee56bf5e3fb27533630a6bac
Ruby
elimiller783/green_grocer-001-prework-web
/grocer.rb
UTF-8
1,139
3.203125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def consolidate_cart(cart:[]) hash = {} cart.each do |item| item.each do |key, value| value[:count] = cart.count(item) hash[key] = value end end hash end def apply_coupons(cart:[], coupons:[]) coupons.each do |coupon| x = coupon[:item] if cart[x] && cart[x][:count] >= coupon[:num]...
true
d6d95f4930de965aa246dfb4a298fde686bdee61
Ruby
alisa1649/brainflayer
/db/seeds.rb
UTF-8
1,270
2.625
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
true
b7de11315c466a76278716c3a2e51e6d525f92a2
Ruby
johnisom/ruby-challenge-problems
/advanced_1/bowling.rb
UTF-8
1,945
3.359375
3
[]
no_license
# frozen_string_literal: true # bowling game class class Game def initialize setup @game_over = false @throws = [] @score = 0 end def roll(pins) validate(pins) @throws << pins if @frame == 10 do_tenth_frame_logic(pins) else @second_throw ^= true unless pins == 10 ...
true
9ed36261c548ae42ce44e7e26762cb2cbd8e41d0
Ruby
ivanacostarubio/vector_with_error
/spec/vector_with_error_spec.rb
UTF-8
669
3.34375
3
[]
no_license
class Vector attr_accessor :data def initialize(data) @data = data end def compare_with_error(y,tolerance) !y.data.each_with_index.map{|number,index| within(number,@data[index],tolerance) }.include? false end private def within(x,y,tolerance) x.between?(y - tolerance, y + tolerance) end ...
true
b61657ee3f92503cb415521afe4b37972b576a5c
Ruby
harryplumer/ruby_calculator
/calculator.rb
UTF-8
2,005
4.375
4
[]
no_license
#all requires go on top require 'pry' def get_input puts "\nPlease enter an equation with space in between each input. Ex: 2 + 2" puts "You may also enter trig functions cos, sin and tan. Ex: cos(180) + sin(32)" puts "You may also type 'quit' to Quit" parse(gets.strip) get_input end def verify_operator(oper...
true
93458fa24bf2bceaff038d63efb5393892b5a8b6
Ruby
paula-lee/phase-0-tracks
/ruby/guessing_game/word_game_spec.rb
UTF-8
1,490
4.25
4
[]
no_license
# pseudocode # initialize method # create an instance variable called pokemon names and it is equal to # an array of pokemon names. # create an instance variable called guess count that is equal to zero # create an instance variable called game over and have that equal to # false. # create an instance vari...
true
f51e86c4258aedfa6a296b6391dfe5609049417c
Ruby
jcjohnny/nauts
/vendor/bundle/gems/formtastic-3.1.3/lib/formtastic/inputs/select_input.rb
UTF-8
9,755
2.59375
3
[ "MIT" ]
permissive
module Formtastic module Inputs # A select input is used to render a `<select>` tag with a series of options to choose from. # It works for both single selections (like a `belongs_to` relationship, or "yes/no" boolean), # as well as multiple selections (like a `has_and_belongs_to_many`/`has_many` relation...
true
7cc2de62d4df04cead562e6f13c355643bd74136
Ruby
codeclanstudentls/reimagined-goggles
/models/wizard_maker.rb
UTF-8
1,830
3.234375
3
[]
no_license
require('pry-byebug') require_relative('../db/sql_runner') class Wizard attr_reader( :first_name, :last_name, :house_name, :age, :id ) def initialize( options ) @id = nil || options['id'].to_i @first_name = options['first_name'] @last_name = options['last_name'] @house_name = options['house_name'...
true
168ce3ed10e23846043eaa8c30fa5e85874e259a
Ruby
zenspider/seeing_is_believing
/spec/binary/marker_spec.rb
UTF-8
2,060
3.015625
3
[ "WTFPL" ]
permissive
require 'seeing_is_believing/binary/data_structures' RSpec.describe SeeingIsBelieving::Binary::Marker do describe 'to_regex' do def assert_parses(input, regex) expect(described_class.to_regex input).to eq regex end it 'doesn\'t change existing regexes' do assert_parses /^.$/ix, /^.$/ix ...
true
b7a086090f96b5c322423029b77861c636a815b2
Ruby
smccarthy/profile-service-presentation
/profile-service-example.rb
UTF-8
1,973
3.125
3
[]
no_license
require 'faraday' require 'json' require 'uri' class ProfileService @@profile_service_url = 'http://localhost:8080' # 1st API request - Add data to profile in the profile service. # This will be done prior to your tests running. def add_to_profile(profile_name:, profile_data:) Faraday.post "#{@@profile_se...
true
46f895403db50149ea782adcf9a0153328f2e0df
Ruby
dembasiby/cp_learn_to_program
/02-numbers/hours_in_a_year.rb
UTF-8
113
2.734375
3
[]
no_license
hours_in_a_day = 24 days_in_a_year = 365 hours_in_a_year = days_in_a_year * hours_in_a_day puts hours_in_a_year
true
7411fc7b75f9a295db64bdc674c3b0abb632c07e
Ruby
gaboncio42/badges-and-schedules-dumbo-web-102918
/conference_badges.rb
UTF-8
560
3.71875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def badge_maker(name) return "Hello, my name is #{name}." end def batch_badge_creator(array) new_badge = [] array.each {|name| new_badge.push("Hello, my name is #{name}.")} return new_badge end def assign_rooms(array) rooms = [] array.each_with_index do |name, index| index_plus_one = index + 1 roo...
true
7ac146b664a9a988c3709f1aa55c6bd9a177545a
Ruby
mgoodhart5/reunion
/test/activity_test.rb
UTF-8
1,640
3.046875
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/activity' require 'pry' class ActivityTest < Minitest::Test def test_it_exists activity = Activity.new("Brunch") assert_instance_of Activity, activity end def test_that_it_is_initialized_with_a_name activity = Activity.new("Brunch")...
true
6a4e02489cc58cf4a9a77cb4f3ec6c805bef7001
Ruby
wakeless/gallball
/spec/models/player_spec.rb
UTF-8
2,382
2.578125
3
[]
no_license
require 'spec_helper' describe Player do let (:golf) { FactoryGirl.create(:sport, :name => 'Golf') } let (:tennis) { FactoryGirl.create(:sport, :name => 'Tennis') } let (:player) { FactoryGirl.create(:player) } let (:player2) { FactoryGirl.create(:player) } it { should have_many(:games) } #failing it { ...
true
9278ff2cd6f5c8db545e9b78a78a7964be24e451
Ruby
sarahdactyl71/Headcount
/test/economic_profile_test.rb
UTF-8
2,891
2.859375
3
[]
no_license
gem 'minitest' require 'minitest/autorun' require 'minitest/pride' require './lib/economic_profile' class EconomicProfileTest < Minitest::Test attr_reader :epr, :ep def setup @epr = EconomicProfileRepository.new epr.load_data({ :economic_profile => { :median_household_income => "./d...
true
33ece8527185c28499de0b1edbf526c4ddd964af
Ruby
nagi/fishy
/lib/game_over.rb
UTF-8
82
2.671875
3
[]
no_license
class GameOver attr_reader :why def initialize(why) @why = why end end
true
a69cd4eab6225b3b6b8df794e69fcd362947d650
Ruby
simonovich88/cycles-and-pattern
/patron2.rb
UTF-8
205
3.125
3
[]
no_license
n=ARGV[0].to_i (n/2).times do |i| if i.even? print "**" else print ".." end end if n.even? print " " else if ((n/2)%2!=0) print "." else print "*" end end
true
75ff350fc4178f34d9f2555d1410c612974798e9
Ruby
karthickpdy/CP
/a20j/array.rb
UTF-8
592
3.34375
3
[]
no_license
n = gets.to_i arr = gets.split(" ").map(&:to_i) zero_array = arr.select{|i| i == 0} zero_count = zero_array.length pos_array = arr.select{|i| i > 0} pos_count = pos_array.length neg_count = n - zero_count - pos_count neg_array = arr - pos_array - zero_array if pos_count == 0 pos_array << neg_array.pop pos_arra...
true
0f9e5c345c83c368f2b954954cd4b4ff268f63c9
Ruby
TatsuyaIsamu/Arrays
/sample.rb
UTF-8
268
2.828125
3
[]
no_license
File.open("./sample.txt", "w") do |file| file.puts("追加テキスト1") file.puts("追加テキスト2") file.puts("追加テキスト3") end # File.open メソッドは外部リソースを使用するのでブロックを使うことでスコープを作る
true
ab81ba0f3b1ef5905e29a8fd90a93020b1c5c714
Ruby
vlebedeff/exercise
/lib/exercise/lcs.rb
UTF-8
1,269
3.34375
3
[]
no_license
module Exercise # Longest common subsequence of two strings that appears in the same relative order, but not # necessarily contiguous def lcs(s1, s2) table = Array.new(s1.size + 1) { Array.new(s2.size + 1) { 0 } } 1.upto(s1.size) do |i| 1.upto(s2.size) do |j| table[i][j] = if s1[i ...
true
9f3db14a379b9b28cafe91c793907f52a510946e
Ruby
fireworksinnovation/za-id-validator
/test/test_za-id-validator.rb
UTF-8
2,020
2.859375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'helper' class TestZaIdValidator < Test::Unit::TestCase include ZaIdValidator context "a valid ID number" do # Test and ID number based on data from # http://en.wikipedia.org/wiki/National_identification_number#South_Africa setup do @valid = "8001015009087" @valid_integer = 8001...
true
71765aacfb2ac0cc4cf523fd95d12e36784ea48c
Ruby
mwagner19446/wdi_work
/w01/d04/Isaac/receipt_reader.rb
UTF-8
286
3.390625
3
[]
no_license
# read information from a receipt and print it out to the user f = File.open("receipt.txt", "r") string_version_of_receipt = f.read array = string_version_of_receipt.split("\n") selector = array.select{|line| line.length>0}.select{ |line| line.include?("$")} puts selector f.close
true
920d4a20ad2496096d6985b84ca7e3e3b371cf71
Ruby
kadambarijena/ruby-exercises
/cli/cli_equal.rb
UTF-8
90
2.578125
3
[]
no_license
# Equal two operands reading command line # ["a", "b"] puts ARGV[0].to_i == ARGV[1].to_i
true
284ebe36d10509b9f5e021b8fa673486444146ad
Ruby
nathanstruhs/the_odin_project
/oop/tic_tac_toe/board.rb
UTF-8
2,226
4
4
[]
no_license
class Board def initialize @board = [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "] @current_player = "" end def display puts puts "3|#{@board[0]}|#{@board[1]}|#{@board[2]}|" puts "2|#{@board[3]}|#{@board[4]}|#{@board[5]}|" puts "1|#{@board[6]}|#{@board[7]}|#{@board[8]}|" puts " a b c " pu...
true
f0c2bd4c5f1f44022b14b64332f5d1b04340368f
Ruby
dpaden/salvo2
/app/models/move.rb
UTF-8
314
2.515625
3
[]
no_license
class Move < ActiveRecord::Base belongs_to :game belongs_to :user #must be in format A:N where A is between A-J(Upper Case) and N is an integer between 1 and 10, 2 OR 3 Alpha Numberics only VALID_MOVE_REGEX = /\A[A-J][1-9]0?\z/ validates :location, presence: true, format: { with: VALID_MOVE_REGEX } end
true
97c5476b2a7a6da9298d2036a017fbe875095a1d
Ruby
jdbernardi/assignment_knights_travails
/tree.rb
UTF-8
1,520
3.546875
4
[]
no_license
Move = Struct.new( :x, :y, :depth, :children, :parent ) class Tree attr_reader :coords, :max_depth, :root, :depth def initialize( coords, max_depth ) @root = Move.new( coords[0], coords[1], 0, [], nil ) @max_depth = max_depth @current_node = @root @count = 1 create_moves end def create_move...
true
48507a6b3f889df18e23533f5c35f9e01dda93af
Ruby
AdamLombard/LS-coursework
/exercises/RubyBasics/UserInput/07-UserNameAndPassword.rb
UTF-8
318
2.953125
3
[]
no_license
USERNAME = 'admin' PASSWORD = 'password' loop do puts ">> Please enter your username:" username_attempt = gets.chomp puts ">> Please enter your password:" password_attempt = gets.chomp break if username_attempt == USERNAME && password_attempt == PASSWORD puts ">> Access denied!" end puts ">> Welcome!"
true
fad7d70081951072f4a380043e59f04acbe1cba7
Ruby
NJichev/blogster
/spec/templates_spec.rb
UTF-8
1,511
2.6875
3
[ "MIT" ]
permissive
require 'spec_helper' describe Blogster::Template do it 'can save path to templates' do path = '/home/terran/scv' name = 'build.md' template = t(path, name) expect(template.path).to eq path expect(template.fullpath).to eq File.join(path, name) end end describe Blogster::Templates do it 'can...
true
5f92f6b4aa7a96e7ba15ff50749ee69a03d34526
Ruby
mjschwartz/high_sn_hn
/lib/high_sn_hn/workers/items_worker.rb
UTF-8
770
2.53125
3
[]
no_license
module HighSnHn class ItemsWorker @queue = :high_sn def self.perform(min_item, max_item) return unless min_item.to_i > 0 && max_item.to_i > 0 (min_item..max_item).each do |id| begin #LOGGER.info("ItemsWorker for: #{id}") item = HighSnHn::HnItem.new(id) if i...
true
3f8f860f93ab6a1a2ab55499a64c8cc90b0ba59c
Ruby
Rockster160/Games
/aoc2022/d16.rb
UTF-8
5,004
2.84375
3
[]
no_license
# $test = true $part = 1 # $pryonce || ($pryonce ||= true) && binding.pry require "/Users/rocco/code/games/aoc2022/base" # Draw.cell_width = 1 input = File.read("/Users/rocco/code/games/aoc2022/d16.txt") input = "Valve AA has flow rate=0; tunnels lead to valves DD, II, BB Valve BB has flow rate=13; tunnels lead to va...
true
ebab9cfaec3efc14e8b6101f57c19c2b5eca723e
Ruby
andyss/active_tool
/lib/active_tool/relation_prob.rb
UTF-8
3,419
2.546875
3
[]
no_license
module ActiveTool module RelationProb class RelationModeProb attr_accessor :mode attr_accessor :probs def initialize(mode, &block) @mode = mode @probs = {} self.instance_eval(&block) end def add_prob(name, options={}) @probs[na...
true
755785d78c69095811126fc914d3ba0c6a4f81c4
Ruby
frantzmiccoli/Gimuby
/tests/genetic/archipelago/test_connected_measure.rb
UTF-8
1,316
2.921875
3
[ "MIT", "LicenseRef-scancode-other-permissive" ]
permissive
require './abstract_test_case' require './mock/population_mock' require 'gimuby/genetic/archipelago/archipelago' require 'gimuby/genetic/archipelago/measure/connected_measure' class TestConnectedMeasure < AbstractTestCase def test_compute size = 10 archipelago = get_archipelago(size) measure = get_conne...
true
0b36117b32deaf58b1478b4db14f79efbe314c5a
Ruby
pranavnawathe/DesignPatternsNew
/ruby/Memento/.idea/home_theatre.rb
UTF-8
474
3.4375
3
[]
no_license
class HomeTheatre def initialize(ledTv, speaker) @ledTv = ledTv @speaker = speaker @@stateCount +=1 end def getLedTv @ledTv end def setLedTv(ledTv) @ledTv = ledTv end def getSpeaker @speaker end def setSpeaker(speaker) @speaker = speaker end...
true
4d4bdcd3c1025cbf318b6ffce6b6a5223c509113
Ruby
apoorvmishra28/whoisproject
/whoisDB.rb
UTF-8
438
2.75
3
[]
no_license
require 'whois-parser' # Arguments to be input by user Domain = ARGV[0] record = Whois.whois(Domain) #whois all-in-one method which fetches complete data at once for given domain parser = Whois::Parser.new(record) # created whois-parser object which is further used for parsing whois informaition puts parser.crea...
true
a006d1f8b41feceb96c56804d9b6001f167dd432
Ruby
danelowe/magedetect
/spec/workers/sites_worker_spec.rb
UTF-8
1,243
2.515625
3
[]
no_license
require_relative '../spec_helper' class Indicators::Test def self.run site site.score += 1 true end end # We want to stub out create_csv, but using a mock will stub out other methods we want to test. SitesWorker.instance_eval do private def create_csv name, sites, header CSV.open(File.join(SPEC_PA...
true
7b7a4a38006df33810e424581aea2a0ba2181cd8
Ruby
rene-dev/pqongmaps
/app.rb
UTF-8
2,918
2.65625
3
[]
no_license
#! /usr/bin/env ruby # Import gems for Sinatra, XML-parsing and json stuff require 'rubygems' require 'bundler' Bundler.require class Cache < ActiveRecord::Base def self.in_area(lat1,lon1,lat2,lon2) where("lat > #{lat2} and lat < #{lat1} and lon > #{lon2} and lon < #{lon1}") end end class Pqongmaps < ...
true
0a707d61db8df31cc941f273154cceb811c7c993
Ruby
liantics/MetisPracticeFiles
/Week1/flash_cards/normal/musicdeck.rb
UTF-8
263
2.9375
3
[]
no_license
require './musiccards' class Deck def initialize(cards) @cards = cards end # def play # @cards.each do |card| # card.play # end # @cards # puts "playing" # end end deck = Deck.new("musiccards.csv") #cards is the filename of the cards file
true
7fc16dcdef7d8bc3f0db1a5e41d7adb36aa752f4
Ruby
CDL-Dryad/dryad-app
/app/helpers/stash_engine/link_generator.rb
UTF-8
5,207
2.90625
3
[ "MIT" ]
permissive
module StashEngine module LinkGenerator def self.create_link(type:, value:) # get [link_text, href] back from the id so we can create normal <a href link> send(type.downcase, value) end # This *should* only be called from #create_link, and if we reach it, # it's because the identifier ty...
true
64b98b62782af6b425a8ad6968195751635869f1
Ruby
herrklaseen/babysleep
/app/models/sleeptime.rb
UTF-8
1,663
3.09375
3
[]
no_license
class Sleeptime < ActiveRecord::Base attr_accessible :start, :duration belongs_to :baby, :inverse_of => :sleeptimes validates :baby, { :presence => true } validates :start, { :presence => true } validates :duration, { :presence => true, :numericality => { :only_integer => true, ...
true
d78a9d5c7830c04f9f4c1fa5831323684746f45f
Ruby
jbmenashi/dunder-mifflin-rails-review-nyc-web-102918
/app/models/dog.rb
UTF-8
197
2.515625
3
[]
no_license
class Dog < ApplicationRecord has_many :employees def employee_count self.employees.count end def self.sort_by_employee_count Dog.all.sort_by(&:employee_count).reverse end end
true
43dd6fe42dc2114cac348a3b66262491d3651490
Ruby
jeromeOthot/Puzzle-Quest-Adventure
/Scripts/Puzzle/Window/Window_PuzzleChrono.rb
UTF-8
1,661
2.71875
3
[]
no_license
#D�claration des constantes HERO_WEAPON_POS_X = 16 HERO_WEAPON_POS_Y = 0 HERO_SHIELD_POS_X = 80 HERO_SHIELD_POS_Y = 0 HERO_ARMOR_POS_X = 0 HERO_ARMOR_POS_Y = 32 HERO_HELMET_POS_X = 32 HERO_HELMET_POS_Y = 32 HERO_BOOTS_POS_X = 64 HERO_BOOTS_POS_Y = 32 HERO_ACCESSORIES_POS_X = 96 HERO_ACCESSORIES_POS_Y = 32 HERO_DEF...
true
db35bb45c866733ca31787c0520b18e905b5d181
Ruby
MariusGG/The_Kingdom
/spec/landCreature_spec.rb
UTF-8
480
2.671875
3
[]
no_license
require 'landCreature' describe LandCreature do it { expect(described_class).to be < TheKingdom } it "should have a starting health point of 10" do expect(subject.hp).to eq 10 end it "has a random amount generator" do expect(subject).to receive(:rand).and_return(12345) expect(subject.amou...
true
c723405527162ac4f66d15294bee176f9c7ff059
Ruby
bmedici/rbpm
/app/models/step_watchfolder.rb
UTF-8
3,185
2.5625
3
[ "MIT" ]
permissive
class StepWatchfolder < Step def paramdef { :watch => { :description => "Incoming folder to watch", :format => :text, :lines => 2 }, :target => { :description => "Target folder to move the detected file", :format => :text, :lines => 2 }, :delay => { :description => "Delay to wait when watchin...
true
a8baa33ed866d295815e801bfc93c5f8750cf295
Ruby
Dane-Dawson/rspec-notes
/Rspec-Ref-Sheets/Built-in-matchers/yield_matchers.rb
UTF-8
5,800
3.453125
3
[]
no_license
#yield_control => matches if the method-under-test yields, regardless of whether or not arguments are yielded #yield_with_args => matches if the method-under-test yields with arguments. If arguments are provided to this matcher, it will only pass if the actual yielded arguments match the expected ones using === or ==. ...
true
4c7aa3415e9672b77a13ba46cc5f4cbc5e42e1da
Ruby
nurrutia/clase23
/ejercicio5.rb
UTF-8
1,871
3.890625
4
[]
no_license
hash = [{ :firstname => "Diego", :country => "Chile", :continent => "south america", :gender => "M" }, { :firstname => "Juan", :country => "Peru", :continent => "south america", :gender => "M" }, { :firstname => "Pedro", :country => "Colombia", :continent => "south america", :gender => "F" }, { :firstn...
true
85bfee631e0c8beed1d42b65984beafeb3d0d113
Ruby
ChrisGoodson/bug-free-octo-garbanzo
/lib/weapon.rb
UTF-8
482
3.375
3
[]
no_license
class Weapon attr_reader :name, :damage attr_accessor :bot def initialize(name, damage = 0) raise ArgumentError if !name.instance_of? String raise ArgumentError if !damage.instance_of? Fixnum @name = name @damage = damage @bot = nil @picked_up = false end def bot=(some_bot) raise...
true
b5fde6d8fa0ce67c224f0c227b26577582b39680
Ruby
Torres-x86-64/x86_64-linux-cheatsheats
/scrape-syscalls.rb
UTF-8
642
2.609375
3
[]
no_license
require "open-uri" require "nokogiri" require "pry" page = Nokogiri::HTML(open("https://filippo.io/linux-syscall-table/")) syscall_rows = page.css(".tbls-table > tr.tbls-entry-collapsed").map do |row| row.css("td").map(&:text).join("\t") end args_rows = page.css(".tbls-table > tr.tbls-arguments-collapsed").map do |r...
true
7410a5a61471ecb813bbc78c24c26fa45554c1db
Ruby
jbr/breakglass
/vendor/plugins/freighthopper/test/array_test.rb
UTF-8
1,269
2.75
3
[ "MIT" ]
permissive
require File.instance_eval { expand_path join(dirname(__FILE__), 'test_helper') } require 'freighthopper' class ArrayTest < Test::Unit::TestCase context 'singular' do should 'return the singular object if there is indeed only one' do assert_singular 5, [5] end should 'return nil if the array i...
true
742873aa471de7801384ec5754f9bf9475005fd1
Ruby
niquola/kung_figure
/test/kung_figure_test.rb
UTF-8
2,327
2.53125
3
[ "MIT" ]
permissive
require File.dirname(__FILE__) + '/test_helper.rb' module MyModule include KungFigure class Config < KungFigure::Base define_prop :prop1,'default1' define_prop :prop2, 2 define_prop :bool,true class NestedConfig < KungFigure::Base define_prop :prop3,'prop3' class NestedNestedConfig < ...
true
c562c7e1fdc4c07c16e31549f1b4e7ead94b42ae
Ruby
Cileos/shiftplan
/lib/time_component.rb
UTF-8
1,529
2.875
3
[]
no_license
class TimeComponent < Struct.new(:record, :start_or_end) FullTimeExp = /\A (?<hour> \d{1,2}) : (?<minute> \d{1,2}) \z/x ShortTimeExp = /\A (?<hour> \d{1,2}) /x # interpret the first 2 digits as hour, discard the rest MinuteInterval = 15 def hour=(hour) @hour = hour.present?? hour.to_i : nil end def a...
true
accb1472a9213a369ae3531b1f3a80b9f4961c3b
Ruby
hrigu/planik_parser
/examples/test_date.rb
UTF-8
160
2.921875
3
[]
no_license
require 'date' puts Date.today d = Date.parse("2013-01-07") #puts d.next_day #puts d.next_day 3 puts d.wday wt = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]
true
49d1900531b35d0f30a43a6ce597a8befeb0482a
Ruby
huijunyam/minesweeper
/board.rb
UTF-8
1,001
3.546875
4
[]
no_license
require_relative 'tile' require_relative 'game' class Board attr_reader :grid, :bomb_positions def initialize @grid = Array.new(9) { Array.new(9) } @bomb_positions = [] @bomb_neighbors = [] end def [](pos) row, col = pos @grid[row][col] end def []=(pos, mark) row, col = pos @...
true
d5f2b74096dd5032585b0072a1d9da8accefb143
Ruby
SmoothTrane/Greed
/client.rb
UTF-8
2,768
3.78125
4
[]
no_license
class Grid def initialize @array = [ [1,2,2,1,1], [1,1,2,2,2,1], [1,1,1,1,1,1] ] rand = Random.new firstIndex = rand.rand(0..@array.length - 1) secondIndex = rand.rand(0..@array[firstIndex].length - 1) @array[firstIndex][secondIndex] = "@" display_grid # for the first val, 0 to @array.len...
true
d62d62ca0e8f7a9752a896f15617692cfc568ad7
Ruby
zjciris/Foodies
/db/seeds/production.rb
UTF-8
6,739
2.703125
3
[]
no_license
###################################### # config ###################################### # allow_image_upload = true && total_num_of_users = 20 -- 3 min # allow_image_upload = true && total_num_of_users = 50 -- 7 min # allow_image_upload = false && total_num_of_users = 50 -- 1 min # allow_image_up...
true
3ab13cb24d998cc22d1430c8aa26d98d22fe0f48
Ruby
Vitoko-Arriagada/ruby-module
/proyecto.rb
UTF-8
423
3.21875
3
[]
no_license
class Proyecto attr_reader :nombre, :descripcion def initialize nombre, descripcion @nombre = nombre @descripcion = descripcion end def presentacion puts "#{@nombre}, #{@descripcion}" end end proyecto1 = Proyecto.new("Proyecto 1", "Descripción 1") puts proyecto1.nombre proyecto1.presentacion ...
true
df3f27a37fa4553fa48a77b214943ffe131dd431
Ruby
mattbehan/project-euler-exercises
/euler_14/euler_14.rb
UTF-8
280
3.46875
3
[]
no_license
hash = {2 => 1} [*3..1000000].each do |number| count = 0 x = number while x > 1 if x.even? x = x/2 else count += 1 x = ( x * 3 ) + 1 end end if count > hash.values[0] hash = {number => count} puts "updating: #{hash}" end end puts "final answer: #{hash}"
true
8ad76526a3bc5507568b60f5979888d23ba8acb6
Ruby
jackslinger/Advent-of-code-2020
/day5/day5.rb
UTF-8
1,831
3.890625
4
[ "MIT" ]
permissive
#!/usr/bin/env ruby example = File.open("day5/example.txt").read input = File.open("day5/input.txt").read.split("\n").map(&:chomp) class Seat attr_reader :number_of_rows, :row_code attr_reader :number_of_cols, :col_code def initialize(input) @row_code = input.slice(0..6).split('') @number_of_rows = 127...
true
07e5a5f11bdc9c408d813be72ab149164ec04ea4
Ruby
chaitali-khangar/data_structure
/SingularCircularLinkedList.rb
UTF-8
136
3.03125
3
[]
no_license
class Node attr_accessor :value, :node_next def initialize(value, node_next) @value = value @node_next = node_next end end
true
2a996c59fbd277c20550597f4b20cfb9b456f68c
Ruby
dyba/cracking_the_ruby_coding_interview
/lib/ctci/linked_lists/palindrome.rb
UTF-8
697
2.8125
3
[]
no_license
require 'ctci/data_structures/stack' module CTCI module LinkedLists def palindrome? list return false unless list runner = list reversed = nil while runner do if reversed front = ::CTCI::DataStructures::SinglyLinkedNode.new(runner.value) front.next = reverse...
true
25b5ddd0d8b749d18ecf51d8ef437a41be3fa14b
Ruby
McNeill2019/SEI-Exercises-35
/Week4/WarmUps/Raindrops /raindrops.rb
UTF-8
1,381
5.03125
5
[]
no_license
#Warmup - Raindrops #Write a program using Ruby that will take a number (eg 28 or 1755 or 9, etc) and output the following: #If the number contains 3 as a factor, output 'Pling'. #If the number contains 5 as a factor, output 'Plang'. #If the number contains 7 as a factor, output 'Plong'. #If the number does not co...
true
f37ea12f874ae31adef66942814a9f6847b43bad
Ruby
birbl/birbl-ruby
/lib/birbl/user.rb
UTF-8
960
2.546875
3
[]
no_license
require 'cgi' module Birbl class User < Birbl::Resource def self.attribute_names super + [ :username, :email, :active, :options, :reservations ] end define_attributes validates_presence_of :username validates_presence_of :email validate...
true
a5e8ccf84678ec6745bf721acf40088772a3b4f8
Ruby
swathi-0901/ruby-joy
/reverse_string.rb
UTF-8
249
4.03125
4
[]
no_license
#Ruby program which accept the user's first and last name and print them in reverse order with a space between them. puts "Input your first name: " fname = gets.chomp puts "Input your last name: " lname = gets.chomp puts "Hello #{lname} #{fname}"
true
547da777b5575b14247f4415d59650ea11997e84
Ruby
piotrmurach/benchmark-perf
/spec/unit/ips_result_spec.rb
UTF-8
1,028
2.578125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true RSpec.describe Benchmark::Perf::IPSResult do it "defaults all calculations to zero" do result = described_class.new expect(result.avg).to eq(0) expect(result.stdev).to eq(0) expect(result.iter).to eq(0) expect(result.dt).to eq(0) end it "adds measurements corre...
true
e79764beb9a1dc569086a0c7cdcb5901180a9090
Ruby
Pau1fitz/Fizz_buzz
/spec/fizzbuzz_spec.rb
UTF-8
1,026
3.359375
3
[]
no_license
require 'fizzbuzz' describe FizzBuzz do let(:fizzbuzz) { FizzBuzz.new } it 'knows 1 is not divsible by 3' do expect(fizzbuzz.divided_by_three?(1)).to eq false end it 'knows 3 is divisible by 3' do expect(fizzbuzz.divided_by_three?(3)).to eq true end it 'knows 1 is not divisible by 5' do exp...
true
4717b38d9a07d629c8694e0afcaf0f30b91986fe
Ruby
pablo31/asistefe
/main.rb
UTF-8
1,622
2.640625
3
[]
no_license
# bundle exec ruby main.rb worksets/201803 15 # see FileManager for directory structure working_directory_path = ARGV[0] practices_interval = ARGV[1].to_i offset_start = ARGV[2]&.to_i offset_end = ARGV[3]&.to_i # entry_ids = ARGV[2].split(',').map(&:to_i) require 'json' require'pry' require './lib/asistefe' includ...
true
6a2085b43c951d799a8e00db951ae02871f5f3fa
Ruby
yoggy/mqtt_rain_checker
/mqtt_rain_checker.rb
UTF-8
1,975
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/ruby # vim: ts=2 sw=2 et si ai : require 'pp' require 'mqtt' require 'logger' require 'yaml' require 'ostruct' require 'json' require 'date' def usage $stderr.puts "usage : #{File.basename($0)} config.yaml" exit(1) end $stdout.sync = true Dir.chdir(File.dirname($0)) $current_dir = Dir.pwd $log = Logg...
true
5aa98643546d7b113763f93a0131e7c9764ab6b6
Ruby
codemilan/old_stuff
/sbs2/rad_core/lib/rad/router/object_router.rb
UTF-8
4,560
2.640625
3
[ "MIT" ]
permissive
class Rad::Router::ObjectRouter include Rad::Router::RouterHelper def initialize self.class_to_resource = -> klass {raise ':class_to_resource not specified!'} self.resource_to_class = -> resource {raise ':resource_to_class not specified!'} self.id_to_class = -> id, params {raise ':id_to_cl...
true
99e784a5cd32a0612555dbf43e5dc80ebc4e2639
Ruby
devmicka/Mardi-Week2-THP-Exo-Ruby
/exo_15.rb
UTF-8
324
3.59375
4
[]
no_license
puts "Salut, bienvenue dans ma super pyramide ! Combien d'étages veux-tu (entre 1 et 25) ?" print "> " height_pyramid = gets.chomp.to_i if (1..25).include? height_pyramid height_pyramid.times do |i| x = i+1 x.times do print "#" end puts end else puts "Donne moi un nombre entre 1 et 25 !" ...
true
597745678eb1b9f7676dd1e4fbd3b2de67788d78
Ruby
vittalgit/lynda-ruby-course
/lynda_ruby_exercise_files/Chapter03/03_03_loops.rb
UTF-8
869
3.53125
4
[ "MIT" ]
permissive
# This file is a transcript of the IRB session shown in the movie. # You should be able to cut and paste it into IRB to get # the same results shown in the comments. #loop do # ...(code block) #end #break #next #redo #retry # irb --simple-prompt x = 0 # => 0 loop do x += 2 break if x >= 20 puts x end # 2 # 4 #...
true
df942fb6eee9883bee01516993b9cbe288a44fd5
Ruby
ShigeruIchinoki/gem_mini_test
/test/gem_mini_test_test.rb
UTF-8
1,098
3.1875
3
[ "MIT" ]
permissive
require 'test_helper' class GemMiniTestTest < Minitest::Test def setup @num = GemMiniTest::Main.new @num2 = GemMiniTest::Main.new end def test_that_it_has_a_version_number refute_nil ::GemMiniTest::VERSION end def test_odd? assert @num.odd?(1)==true, '1 is odd' refute @num.odd?(2), '...
true
acda902255113b019ca5eed818357422719641af
Ruby
stjeeves/week2_day3_pub_class_lab
/specs/drink_class_spec.rb
UTF-8
573
2.96875
3
[]
no_license
require("minitest/autorun") require("minitest/reporters") MiniTest::Reporters.use! Minitest::Reporters::SpecReporter.new require_relative("../drink_class") class TestDrink < MiniTest::Test def setup() @drink1 = Drink.new("beer", 400, 5) @drink2 = Drink.new("whisky", 500, 40) @drink3 = Drink.new("wine",...
true