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
ff6f8695b226c2d1fa6287e850f1983cb75f6771
Ruby
panickat/CodeaCampRuby
/sem2/dia1/7_block_andprime.rb
UTF-8
308
4.3125
4
[]
no_license
#Define el método prime que acepte un parámetro y use yield para llamar a un bloque. El bloque debe regresar los primeros diez números primos en un arreglo. #test #=>[2, 3, 5, 7, 11, 13, 17, 19, 23, 29] def prime(a) yield a end p prime(prime.first(10)) {|i| i} == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
true
13304fe86df197983b6fd3a3c39b9b9ecc6c2194
Ruby
chas-mcmahon/Spearmint
/app/models/company.rb
UTF-8
731
2.640625
3
[]
no_license
class Company < ActiveRecord::Base include MoneyHelper belongs_to :user has_many :cash_accounts has_many :credit_accounts has_many :loan_accounts validates :name, :user_id, presence: true validates :name, uniqueness: {scope: :user_id} #update to include the values of all account types def total_acc...
true
5c1b8593277ad95328be65998082dce6b801cdaf
Ruby
Part1nax777/rack_task
/middleware/time.rb
UTF-8
540
3.15625
3
[]
no_license
class TimeString TIME_FORMATS = { 'year' => '%Y', 'month' => '%m', 'day' => '%d', 'hour' => '%H', 'minute' => '%M', 'second' => '%S' }.freeze def initialize(params) @time_params = params.split(',') end def invalid_params @time_params.reject { |t| TIME_FORMATS.include?...
true
0351c54d21973718db16f7bb04d762821df39235
Ruby
TannerDale/exercism
/ruby/matrix/matrix.rb
UTF-8
523
3.8125
4
[]
no_license
=begin Write your code for the 'Matrix' exercise in this file. Make the tests in `matrix_test.rb` pass. To get started with TDD, see the `README.md` file in your `ruby/matrix` directory. =end class Matrix def initialize(matrix) @matrix = deconstruct(matrix) end def deconstruct(matrix) matrix.split("\n"...
true
07fa374af222b33a6b8d76b172c3bf8c351360bb
Ruby
devise-security/devise-security
/test/test_secure_validatable_overrides.rb
UTF-8
4,889
2.59375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true require 'test_helper' class TestSecureValidatableOverrides < ActiveSupport::TestCase class ::CustomClassPasswordValidator < DeviseSecurity::PasswordComplexityValidator def patterns super.merge(letter: /\p{Alpha}/) end end class ::CustomInstancePasswordValidator < Dev...
true
3500c10411a7755a6f1036e8f2f4f43e08b8ff77
Ruby
codereport/LeetCode
/0176_Problem_1.rb
UTF-8
381
2.796875
3
[]
no_license
# code_report Solution # Problem Link (Contest): https://leetcode.com/contest/weekly-contest-176/problems/count-negative-numbers-in-a-sorted-matrix/ # Problem Link (Practice): https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/ # Video Link: https://youtu.be/pDbDtGn1PXk def count_neg...
true
dfc34800edcc2a125ff45b9ef0a44de06fde2c52
Ruby
thib123/TPJ
/Notes/Ruby/sample_code/ex0589.rb
UTF-8
191
2.5625
3
[ "MIT" ]
permissive
# Sample code from Programing Ruby, page 337 module NameSpace class Example CONST = 123 end end obj = NameSpace::Example.new a = NameSpace::Example::CONST
true
7af1215ad6da4441560e57ce51afc69fb599c26f
Ruby
brianmd/geo
/lib/geo_location.rb
UTF-8
1,044
2.953125
3
[ "MIT" ]
permissive
module Geo class GeoLocation include Virtus.model include ActiveModel::Validations attribute :latitude, Float attribute :longitude, Float validates :latitude, :longitude, presence: true, numericality: {only_float: true} def to_a [latitude, longitude] end def distance_from(oth...
true
e8ff3d32fa9fed4cbb72f0d8f3986b444129fd4e
Ruby
zishe/problems
/codewars/calc.rb
UTF-8
538
3.359375
3
[]
no_license
class Calc ENGLISH_TO_OP = {zero: 0, one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, plus: :+, minus: :-, times: :*, divided_by: :/} def method_missing(m) if s = ENGLISH_TO_OP[m] (@cmd ||= []) << s return @cmd[0].send(*@cmd[1..2]) if @cmd.size == 3 self el...
true
8f8f32ceaecaad9da7e5fa46ba22ec0ada0ebce1
Ruby
NixOS/mobile-nixos
/examples/installer/app/lib/file.rb
UTF-8
132
2.640625
3
[ "MIT" ]
permissive
class File def self.write(filename, contents) File.open(filename, "w") do |file| file.write(contents) end end end
true
16c69eba1ebf791ec5c206a353d373df3be24a55
Ruby
vshatravenko/kite
/lib/kite/helpers.rb
UTF-8
1,370
2.984375
3
[ "Apache-2.0" ]
permissive
module Kite::Helpers # Check config/cloud.yml file to be complete def check_cloud_config(config) raise Kite::Error, 'The config/cloud.yml is not filled out!' unless config.find { |key, hash| hash.find { |k, v| v.nil? } }.nil? end # Parse config/cloud.yml, returning the output hash def parse_cloud_config ...
true
07f595ab5d3dfda5d4779ca1c914d503ca808506
Ruby
tonyr729/black_thursday
/lib/transaction.rb
UTF-8
678
2.75
3
[]
no_license
require 'time' class Transaction attr_accessor :id, :name, :invoice_id, :credit_card_number, :credit_card_expiration_date, :result, :created_at, :updated_at def initialize(transaction_info) @id = transaction_info[:id].to_i @invoice_id = transaction_info[:inv...
true
c8433d64393631b7b096c2553cdae56037a8a77d
Ruby
asaki444/ruby-collaborating-objects-lab-v-000
/lib/artist.rb
UTF-8
799
3.484375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Artist attr_accessor :name, :songs def initialize(name) @name = name @songs = [] end @@all = [] def songs @songs end def add_song(song) @songs << song song.artist = self # binding.pr end def save @@all << self end def self.all ...
true
09d6fc4443a947d4abcdf96fd1ea5ecdeca8c175
Ruby
mattcaesar/App-Academy
/2 Software Engineering Foundations/30 TicTacToe/tic_tac_toe-v3/code/human_player.rb
UTF-8
1,152
3.671875
4
[]
no_license
class HumanPlayer attr_reader :mark def initialize(mark_value, n) @mark = mark_value @grid_length = n end def get_position(position_arr) p "Player #{@mark}, enter a position as 'row-number [space] column-number'" position = gets.chomp.split(" ").map(&:to_i) ...
true
f3dd1c034a344b032e7f6f77bb69d692f4bf214d
Ruby
codebreeze/learn_ruby
/02_calculator/calculator.rb
UTF-8
534
3.671875
4
[]
no_license
def add(num1, num2) num1 + num2 end def subtract(num1, num2) num1 - num2 end def sum(array) if array.empty? 0 else sum = 0 i = 0 while i < array.length array.each do |number| sum += number end return sum end end end def multiply(*number) result = 1 number.each ...
true
43290d2fb70ecec07349b15a1f52010c86da614d
Ruby
komeiatecnologia/kgem_pagseguro
/lib/pagseguro/shipping.rb
UTF-8
1,076
2.78125
3
[]
no_license
module PagSeguro class Shipping TYPE = { :pac => 1, :sedex => 2, :not_specified => 3 } InvalidShippingTypeError = Class.new(StandardError) include Extensions::MassAssignment include Extensions::EnsureType attr_reader :type_id attr_reader :type_name attr_reader :add...
true
defff74a019afee2380e3b710f74158faffbf196
Ruby
SimonDein/launch
/course_130/lesson_1_blocks/build_a_select_method.rb
UTF-8
475
4.40625
4
[]
no_license
def select(arr) index = 0 new_arr = [] while index < arr.size current_element = arr[index] new_arr << current_element if yield(current_element) index += 1 end new_arr end array = [1, 2, 3, 4, 5] p select(array) { |num| num.odd? } # => [1, 3, 5] p select(array) { |num| puts num } # => ...
true
2928d7d166cf457c6301a0a12fb28be2670ee28f
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/src/1358.rb
UTF-8
243
3.296875
3
[]
no_license
def compute (a, b) a = a.chars b = b.chars a = a.slice(0, b.count) if a.count > b.count b = b.slice(0, a.count) if b.count > a.count distance = 0 a.zip(b).map { |x, y| distance += 1 if x != y } return distance end
true
af873e88444ec258b5fe7f44506048e59171e56b
Ruby
petertseng/secret_fascists
/lib/secret_fascists/choice.rb
UTF-8
460
2.8125
3
[ "Apache-2.0" ]
permissive
# Represents a choice that can be made for a Decision. # Not to be exposed to clients. module SecretFascists; class Choice attr_reader :description def initialize(description = nil, &block) @description = description.freeze @block = block end def requires_args? !@block.parameters.empty? end #...
true
7b47acba69ccd9f2a728952b40e3fc4a700ec7a8
Ruby
carlosjhr64/rubbish
/lib/rubbish.rb
UTF-8
1,821
2.640625
3
[ "MIT" ]
permissive
module Rubbish VERSION = '1.1.221208' SHELL_VERSION = {bash: nil, fish: nil} # This is a contraction of Shellwords.escape function SHELLWORDS_ESCAPE = lambda{|w|w.gsub(/[^\w\-.,:+\/@\n]/,'\\\\\\&').gsub(/\n/,"'\n'")} def self.shell(script=nil, shell:'bash', read:true, &block) IO.popen(shell, (read)? 'w+'...
true
1bf9aa3221968a5e6a963e96fa145b46761ff011
Ruby
pierrewebdev/CLI-Fitness-App
/app/models/lifter.rb
UTF-8
2,029
3.171875
3
[]
no_license
class Lifter < ActiveRecord::Base # add associatons! has_many :exercise_logs has_many :exercises, through: :exercise_logs #create -------------------------------- def self.create_lifter(name) lifter = self.create(name:name) lifter end #this works #read ------------------------...
true
fae209ac068aecb061e2e35f5155a4d1db80296e
Ruby
1o1brian/ellington
/lib/ellington/goal.rb
UTF-8
374
2.90625
3
[ "MIT" ]
permissive
module Ellington class Goal def initialize(*states) @inner_list = states.map(&:to_s) inner_list.freeze end def include?(state) inner_list.include? state.to_s end def achieved?(passenger) return false if passenger.nil? include? passenger.current_state.to_s end ...
true
bace31f2456254bea9ead5165eea7377fb97c3ec
Ruby
doublechiang/books
/hfrails/coconut/app/models/seat.rb
UTF-8
505
2.609375
3
[]
no_license
class Seat < ActiveRecord::Base belongs_to :flight # validates_numericality_of :baggage, less_than_or_equal_to: flight.baggage_allowance validate :check_baggage_allowance validate :check_flight_capacity private def check_baggage_allowance if baggage > flight.baggage_allowance errors.add(:base, "You...
true
3a81464ed3a9633ff7b3df3b29845807eab41fb5
Ruby
urbantumbleweed/urbantumbleweed
/w01/d04/Igor_Yuzovitskiy/magician.rb
UTF-8
2,528
4.40625
4
[]
no_license
# # Magician # # Create a file called magician.rb # # Create a hash for a person whose name is "David Copperfield" whose hometown is "Metuchen" and store it in a variable called person1 person1 = { name: "David Copperfield" , hometown: "Metuchen" } # # Create a hash for a person whose name is "Syphilis Rivendell" wh...
true
dd732dcdda5d2437e641dd4a8dc2729f3b5e8d68
Ruby
mharris717/ember-auth-easy
/mock_server/main.rb
UTF-8
1,541
2.8125
3
[]
no_license
require 'sinatra' require 'json' get "/" do "hello" end helpers do def set_origin response['Access-Control-Allow-Origin'] = '*' response['Access-Control-Allow-Headers'] = "Origin, X-Requested-With, Content-Type, Accept" end def users $users ||= [{id: 1, email: "user@fake.com", password: "password...
true
c936a07114069e26e294358d1118f7abf7df0e9e
Ruby
joshua-arts/farm-radar
/source/jobs/status.rb
UTF-8
618
2.859375
3
[]
no_license
require 'json' require 'serialport' file = File.open('out.text', 'r') SCHEDULER.every '1s' do @input = file.readline file.seek(0) if(@input == "0") return; end moisture = @input[1]; h = @input[@input.index("h") + 1, @input.size()]; humidity = h[0, h.index("t")]; t = @input[@input.index("t") + 1...
true
9e8e322283347fe4f1b09b08fcf95a0ba1986547
Ruby
jkeroes/learn-ruby-the-hard-way
/exercises/11/ex11.rb
UTF-8
1,124
4.25
4
[]
no_license
print "How old are you? " age = gets.chomp() print "How tall are you? " height = gets.chomp() print "How much do you weigh? " weight = gets.chomp() puts "So, you're #{age} years old, #{height} tall and #{weight} heavy." # Extra Credit 1: Go online and find out what Rubys gets and chomp methods do. # # => gets returns...
true
e4a4bed9ee4cc580f0f39d8efb584e405dff9857
Ruby
erikaden-appdev2/rails_project
/lib/tasks/dev.rake
UTF-8
2,518
2.8125
3
[]
no_license
desc "Fill the database tables with some sample data" task sample_data: :environment do starting = Time.now Trip.delete_all Photo.delete_all Participant.delete_all Highlight.delete_all User.delete_all people = Array.new(10) do { first_name: Faker::Name.first_name, last_name: Faker::Name....
true
57837ae456ff13ecada1a3d7ab28851152ec8c1d
Ruby
amos03/ruby_methods_task3
/exercise5.rb
UTF-8
81
2.984375
3
[]
no_license
def hello_name(name) return "Hello, #{name}!" end p hello_name("Curmudgeon")
true
e195a526d7ce217ed58b434826a5bd1c119d3539
Ruby
daniel-dawson/reverse-each-word-online-web-sp-000
/reverse_each_word.rb
UTF-8
173
3.546875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(sentence_string) word_array = sentence_string.split(" ") new_array = word_array.collect do |word| word.reverse end new_array.join(" ") end
true
13d1837e1ad1002c20148cc26e840cdf69106dff
Ruby
djbjoo/codester
/Hello.rb
UTF-8
355
4.125
4
[]
no_license
# puts "enter your name:" # f = gets # puts "hello #{f}" # reminder to self: finish this program def square (n) puts "#{n} squared is:" return n * n end # puts "enter a number" # numb = gets numb = ARGV[0] numb = numb.chomp.downcase if numb == "pi" or (numb == "π" or numb == "∏") numb = Math::PI else numb = n...
true
3a962ca11e0c5d6596b4fb6066bc1452643909d2
Ruby
andrewhw/LWT-coding-group
/ruby/01-input-output/fahrenheit
UTF-8
1,433
4.125
4
[]
no_license
#!/usr/bin/env ruby # loop over lines read from "standard input" (the keyboard) # stopping when either no line is read, or the line starts # with a 'q' # read lines from "standard input" line = gets # The below while looks odd, but we can break it down like this: # line.nil? -- this indicates whether this lin...
true
e6203938d074abf27dfd1ee81cc20c12d433cabb
Ruby
angeljolon/learn-co-sandbox
/calculator.rb
UTF-8
532
3.875
4
[]
no_license
puts "Welcome KWK Calculator!" sleep(0.4) puts "What operation do you want to perform?" puts "add" puts "subtract" puts "multiply" puts "divide" choice = gets.strip if choice = "add" puts "ENTER PROBLEM" PROBLEM = gets.strip if operation == "add" puts "ENTER FIRST VALUE" puts "ENTER FIRST VA...
true
02775ae8a861b36288dd4fed2d851bb46a7e110c
Ruby
mlincoln/ets-qa
/pages/suitec/engagement_index_page.rb
UTF-8
15,490
2.515625
3
[]
no_license
require_relative '../../util/spec_helper' module Page module SuiteCPages class EngagementIndexPage include PageObject include Logging include Page include SuiteCPages # Loads the Engagement Index tool and switches browser focus to the tool iframe # @param driver [Selenium:...
true
52008c2e22a57948ae587d577f4a80a9979ff3b6
Ruby
Ammar-64/cartoon-collections-re-coded_staff
/cartoon_collections.rb
UTF-8
629
3.515625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(names)# code an argument here # Your code here names.each_with_index do |el, i| puts "#{i+1}. #{el}" end end def summon_captain_planet(planeteer_calls)# code an argument here # Your code here planeteer_calls.map do |el| el[0].upcase + el[1, el.length] + "!" end end def long_p...
true
5bcec1c31dd7bb2116c8e4148409c01eae188483
Ruby
slague/black_thursday
/lib/item_repository.rb
UTF-8
1,006
3.078125
3
[]
no_license
require 'csv' require_relative 'repository' require_relative 'item' require 'bigdecimal' class ItemRepository < Repository attr_reader :klass, :data def initialize(sales_engine, path) super(sales_engine, path, Item) end def all data end def count data.count end def find_by_id(id) d...
true
4284b85d0448aa08bab886d6f2b51aa4b9bf0ef6
Ruby
itokeso/drill
/drill34.rb
UTF-8
560
3.625
4
[]
no_license
# シーザー暗号と呼ばれる暗号があります。これはアルファベットをある文字数分ずらすという暗号方式で、例えば「a」を2文字分ずらす(進める)と「c」になります。 # 「frqjudwxodwlrq」という文字列があり、これを3文字ずらす(戻す)と復号できることがわかっています。それを実現させるコードを記述してください。 char = "frqjudwxodwlrq" str = char.split("") code = [] str.each do |str| code << (str.ord - 3).chr end puts code.join
true
38cc12888c603adcf9020fd2fb719f6870bc56db
Ruby
SiCuellar/brownfield-of-dreams
/app/facades/invite_facade.rb
UTF-8
746
2.609375
3
[]
no_license
class InviteFacade def initialize(g_user, current_user) @g_user = g_user @current_user = current_user @_current_user_search_result @_prospect_search_result end def prospect_name prospect_search_result.response_specific_user[:name] end def user_name current_user_search_result.respons...
true
d6515fa4a16d574738573fb2388e2dccf52177cc
Ruby
yeemans/connect4
/lib/connect4.rb
UTF-8
1,991
3.859375
4
[]
no_license
class Board attr_accessor :cells def initialize(cells) @cells = cells end def game_end?(cells) # iterate through cells, see if each spot has a connect 4 # 4 across check i = 0 while i < cells.count # 4 across return true if cells[i] == cells[i +...
true
2fe4c479f8891ae263fb783c1cd14f24674e4eb9
Ruby
codewithjulie/ruby_tidbits
/day28.rb
UTF-8
966
4.3125
4
[]
no_license
# Sometimes when a topic gets challenging, I make sure I go back and understand the basics. What is a block? # A chunk of code that is passed into a method to be executed # Yesterday we saw this when I used the yield keyword def some_method yield end # Curly braces block is functionally the same as the do...end b...
true
48174c023adf57fad213e550aa6c71407965769c
Ruby
aagooden/ultimate_tictactoe
/classes/player.rb
UTF-8
359
3.359375
3
[]
no_license
class Player attr_accessor :name, :piece, :type def initialize(name, type, piece) @piece = piece @name = name @score = 0 @type = type end def increase_score @score +=1 end def score @score end def choose_move(game, board) @type...
true
b0d46a30c8367f598615a874ed79205d19c387e1
Ruby
emerayo/tictactoe
/specs/models/game_spec.rb
UTF-8
2,975
2.921875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require_relative '../spec_helper' describe Game, type: :model do let(:board) { Board.new(Marker::M1, Marker::M2) } let(:robot1) { Robot.new('Player 1', 'X', RobotDifficulty::HARD) } let(:robot2) { Robot.new('Player 2', 'O', RobotDifficulty::HARD) } let(:game) { Game.new } bef...
true
498f665e528466751f9748b89f439f68447d8bb1
Ruby
calacademy-research/antcat
/app/services/taxa/link_each_epithet.rb
UTF-8
1,474
2.546875
3
[]
no_license
# frozen_string_literal: true module Taxa class LinkEachEpithet include Service attr_private_initialize :taxon # This links individual parts of a name to different catalog pages (species and below). # For genus and above there is only a single name, so just link that (including # subgenera whic...
true
be36c95eef49b2f26bc13e2f8bade3de06042b43
Ruby
AdamDouglasCalkins/My-Users-App
/db.sql.rb
UTF-8
7,006
2.75
3
[]
no_license
#!/usr/env ruby ## ## QWASAR.IO -- rename this db.sql ## ## ## require 'sqlite3' require 'sinatra' require 'rubygems' set :port, 8080 #set :bind, '0.0.0.0' enable :sessions class User # constructor def initialize() #puts "constructor intiated" begin db = SQLite3::Database.open "my_...
true
882a60397300df9ea74ea49174dce1fd207fb8a6
Ruby
acandael/health-media-society
/vendor/bundle/gems/in_threads-1.2.2/lib/in_threads/thread_limiter.rb
UTF-8
919
3.28125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'thwait' class InThreads # Use ThreadsWait to limit number of threads class ThreadLimiter # Initialize with limit def initialize(count) @count = count @waiter = ThreadsWait.new end # Without block behaves as <tt>new</tt> # With block yields it with <tt>self</tt> and ensures...
true
1b2bd069a9aa0530023b35d97b10ff93605f78cd
Ruby
fleurhim/fleur_game_POO
/app_2.rb
UTF-8
2,551
3.46875
3
[]
no_license
require 'bundler' Bundler.require require_relative 'lib/game' require_relative 'lib/player' puts "-------------------------------------------------" puts "|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |" puts "|Le but du jeu est d'être le dernier survivant !|" puts "-------------------------------------------------...
true
887431d3b2dca3e5f76e3b9389a7683d7eb43aa8
Ruby
CloneableX/programming-ruby
/10-threads-and-processes/spawn_new_process_3.rb
UTF-8
167
2.828125
3
[]
no_license
pipe = IO.popen("-", "w+") if pipe pipe.puts "Get a job" $stderr.puts "Child says #{pipe.gets.chomp}" else $stderr.puts "Dad says #{gets.chomp}" puts "Ok" end
true
1304713a08077fc57ff6b3d1b1ca96aca73ec04b
Ruby
chrisdav6/Learn_Ruby_the_Hard-Way
/ex11.rb
UTF-8
1,182
4.9375
5
[]
no_license
# Exercise 11: Asking Questions # Ask a user for their name and print it # Prints to the screen print "How old are you?" # promps the user for a string value and stores it in a variable age = gets.chomp # Prints to the screen print "How tall are you?" # promps the user for a string value and stores it in a variable...
true
1c722b14bf818aa45fe83347c8ef6427f0ed1ecf
Ruby
lorenzocovarrubiasjr/pokemon-scraper-v-000
/lib/pokemon.rb
UTF-8
576
3.09375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Pokemon attr_accessor :name, :type, :db, :id, :hp @@all = [] def initialize(id: 1, name: "Pokemon name", type: "Pokemon type", db: "db/pokemon.db") @id = id @name = name @type = type @db = db @@all << self end def self.all @@all end def self.save(name, type, db)...
true
8eaa7f884860f191927bb83c90170b65854e282e
Ruby
CodingItWrong/battle_logic
/spec/units/factory_spec.rb
UTF-8
3,191
2.5625
3
[ "MIT" ]
permissive
RSpec.describe BattleLogic::Factory do let(:factory) { described_class.new } describe '#character' do let(:fields) do { max_health: 3, attack_rating: 2, defense_rating: 1, } end context 'with no configured attack action' do subject(:character) { factory.charac...
true
26e8dcd00903b7f10b8fdd9eef9a6f86d4bffbef
Ruby
sammy/Blackjack
/blackjack_oop.rb
UTF-8
3,030
4.15625
4
[]
no_license
# encoding: utf-8 class Participant attr_accessor :name, :hand def initialize @hand = [] end def draw(card) hand << card end def show_hand(*one) if one.empty? hand.each do |card| print card.value + card.suit + ' ' end else print hand.last.value + hand.last.sui...
true
b1ebf37d8d29cf78923db59332d2ebe8b2c6ab82
Ruby
squeakyc/tts-blog
/app/controllers/practice_controller.rb
UTF-8
379
2.53125
3
[]
no_license
class PracticeController < ApplicationController def index @name = params[:name] end def about @color = params[:color] end end # one of the controllers jobs is to set up instance variables for the view to use. # Now go to the about view (about.html) and set it up with the @color instance variable. # # ...
true
c3837aa04060a46ba3467c6ab33272e614141c9e
Ruby
ipoval/scripts
/mad_libs.rb
UTF-8
1,107
3.734375
4
[]
no_license
#!/usr/bin/env ruby puts 'ENTER GAME TEXT:' # TEXT = STDIN.readline TEXT = 'Our favorite language is ((gem:a gemstone)). We think ((gem)) is better than ((a gemstone)).' input_words = [] links = {} # will point to the index in the input_words # 1st step - find all links and words TEXT.scan(/\(\((.+?)\)\)/).flatten....
true
93ca62544f3ca2ec6699a7c93ac59ece6336e551
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/sieve/3209109b7c7a40158ede5a509c269b5c.rb
UTF-8
159
3.203125
3
[]
no_license
require 'prime' class Sieve attr_reader :primes def initialize(max) @primes = Prime::EratosthenesGenerator.new.take_while { |n| n <= max } end end
true
8fc669d4aaec184b26d51a9b7bbfb87dc09f0a74
Ruby
lucassherwin/ruby-enumerables-hash-practice-nyc-pigeon-organizer-lab-nyc-web-021720
/nyc_pigeon_organizer.rb
UTF-8
471
3.09375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def nyc_pigeon_organizer(data) # write your code here! organized_pigeons = {} data.each do |key, value| value.each do |new_val, pigeon_names| pigeon_names.each do |name| if !organized_pigeons[name] organized_pigeons[name] = {} end if !organized_pigeons[name][key] ...
true
2ec12ab9c9cc4aa3bcb5dc43350ccb43b9438106
Ruby
shadow3x3x3/graph-generator
/spec/graph_creater_spec.rb
UTF-8
587
2.625
3
[]
no_license
require "spec_helper" require_relative "../graph_creater.rb" describe GraphCreater do describe "edge check" do it "edges out of range" do gc = GraphCreater.new(node: 2, edge: 3) expect(gc.edge_out_of_range?).to be true end it "edges not out of range" do gc = GraphCreater.n...
true
58a150ac3bf0407d5a7660cf4785a2a6900078de
Ruby
larsjoakimgrahn/advent-of-code
/2018/7/common.rb
UTF-8
893
2.984375
3
[]
no_license
input_data = File.readlines('input.txt') class Step attr_reader :dependent, :prerequisites attr_writer :dependent, :prerequisites def initialize(dependent, prerequisites, units_of_work=0) @dependent = dependent @prerequisites = prerequisites @units_of_work = units_of_work end e...
true
d5d5cee6e22d604f1f35ea9cae6aec5efca27961
Ruby
wolfmathias/badges-and-schedules-online-web-ft-090919
/conference_badges.rb
UTF-8
552
3.578125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def badge_maker(person) return "Hello, my name is #{name}." end def batch_badge_creator(attendees) badges = [] attendees.each do | name | badges.push("Hello, my name is #{name}.") end badges end def assign_rooms(attendees) room_list = [] attendees.each_with_index do | name, index | room_list.p...
true
9ae2d1465b3d9444a5433bd849e2275431cd3ffb
Ruby
Tubbz-alt/planner-core
/app/models/postal_address.rb
UTF-8
1,866
2.515625
3
[ "Apache-2.0" ]
permissive
class PostalAddress < ActiveRecord::Base attr_accessible :lock_version, :line1, :line2, :line3, :city, :state, :postcode, :country, :isdefault, :latitude, :longitude, :state_code, :country_code audited :allow_mass_assignment => true has_many :addresses, :as => :addressable has_many :people, ...
true
66ac15688e6d14c709067391d36a8e3733b72793
Ruby
casey-122/communityManagement
/communityManagement/app/models/club.rb
UTF-8
1,105
2.515625
3
[]
no_license
class Club < ApplicationRecord has_many :club_comments, dependent: :destroy has_many :news #dependert 选项可以使得删除一个社团时,社团的相关留言也删除 #这两行声明能够启用一些自动行为。 # 例如,如果 @club 实例变量表示一篇文章, # 就可以使用 @club.comments 以数组形式取回这个社团的所有留言。 validates :club_name, presence: true #获取社长真实姓名 def get_real_name yong_hu_id = self.yo...
true
541790b6e37bd9e47b429687d9d23e5084fff144
Ruby
gsinclair/rgeom
/test/dsl/parameters.rb
UTF-8
2,769
2.828125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# Test some complex parameter matching. D "DSL -> Parameters" do D.< do @register = RGeom::Register.instance @register.clear! points :A => p(3,1), :B => p(6,1), :C => p(7,2) @segment = Segment.simple( p(4,5), p(-1,-1) ) end D "lengths: [n,n]" do str = "lengths: [n,n]" parameter_set = P...
true
56c888452fdd6550574d57a5a4c8180b6ae268f1
Ruby
wjdix/go-election
/lib/go_player/edge_voter.rb
UTF-8
857
2.953125
3
[]
no_license
module GoPlayer class EdgeVoter include Celluloid OPENING_LENGTH = 16 def initialize(recorder, color) @recorder = recorder @color = color end def vote(position) return nil if @recorder.moves.count >= OPENING_LENGTH if too_close_to_edge?(position) GoPlayer::Votes::V...
true
5252ffe80c1d10e6ac9e29d7eb20aebe7f85fcd0
Ruby
jejacks0n/hre.fr
/app/validators/password_validator.rb
UTF-8
1,037
3.03125
3
[]
no_license
class PasswordValidator < ActiveModel::EachValidator DEFAULT_COMPLEXITY_REQUIRED = 2 DEFAULT_MIN_LENGTH = 8 def self.valid?(password) return false if password.nil? checks = [] checks << validate_uppercase(password) checks << validate_numerical(password) checks << validate_length(password) ...
true
844d70759d42e2de1cad5864809725c254c5a7fd
Ruby
ha4gu/atcoder
/ABC/130/132/D2.rb
UTF-8
2,291
3.484375
3
[]
no_license
def calc_combination_string(n, m) if !n.kind_of?(Integer) || !m.kind_of?(Integer) || n < m || n <= 0 || m <= 0 nil elsif m == 1 || n - m == 1 "#{n}" elsif n == m "1" else m = [(n - m), m].min # denominator: 分母 denominator = "#{n}" (n-1).step(n-m+1, -1) do |num| denominator += ...
true
a43bb9ca6d909a2a4491751ec7b7ad3e38626596
Ruby
benno1323/restaurant_app
/spec/controllers/items_controller_spec.rb
UTF-8
3,691
2.515625
3
[]
no_license
require 'rails_helper' RSpec.describe ItemsController, type: :controller do let(:valid_attributes) { attributes_for(:item) } let(:invalid_attributes) { attributes_for(:item, name: nil) } let(:updated_attributes) { attributes_for(:item, name: 'Updated name') } before(:each) do @dish = create(:dish) @item = cre...
true
06a20b69d87d1871dac7b20f40d732610a2a3282
Ruby
activefx/url_parser
/spec/url_parser/parser_spec.rb
UTF-8
13,610
2.640625
3
[ "MIT" ]
permissive
require 'spec_helper' RSpec.describe UrlParser::Parser do let(:url) { 'http://example.com/path' } context ".new" do it "sets #uri" do expect(described_class.new('#').uri).to eq '#' end it "sets options" do opts = { host: 'localhost' } expect(described_class.new('#', opts).options)...
true
33722eebabcd0a267e1ec0a801306901f532ae65
Ruby
gaflorez47/project-euler
/1-10/p1.rb
UTF-8
222
3.578125
4
[]
no_license
def sum n numbers = [] index = 1 result = n while result < 1000 do numbers.push result index += 1 result = index * n end numbers end s5 = sum 5 s3 = sum 3 s = (s5 + s3).uniq.sort puts s.reduce(:+)
true
4d9d074d5f539b5e75faa0461a62600246915525
Ruby
eakmotion/RubyPracticeProblems
/filter_the_number.rb
UTF-8
433
3.25
3
[]
no_license
# Return a number from a string require 'spec_helper' def filter_string(string) string.delete("^0-9").to_i end RSpec.describe "filter_string" do it "Example cases" do expect(filter_string("123")).to eq(123) expect(filter_string("a1b2c3")).to eq(123) expect(filter_string("aa1bb2cc3dd")).to eq(123) ...
true
223332e95559b8a9bdf61b47ca1c8586332b34b3
Ruby
elanapocress/kwk-l1-curfew-checker-kwk-students-l1-nyc-080618
/curfew_checker.rb
UTF-8
130
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def curfew_checker(x) if x > 11 puts "you are in trouble!" else puts "you are not in trouble" end end curfew_checker(12)
true
86ff4188583e4d336c7e6853dfa67123108e9417
Ruby
castrodd/pearls
/8/vector_one.rb
UTF-8
423
3.609375
4
[]
no_license
# Given an array of integers, find the maximum output of any subvector. # Version 1 (O(n^3)) def vector(arr) maxsofar = 0 (0..arr.length-1).each do |index| (index..arr.length-1).each do |subindex| sum = 0 (index..subindex).each do |ele| sum += arr[ele] end maxsofar = sum if sum ...
true
3f262142766bb80091d19fd2d15f701d43abdbaa
Ruby
bnascimento89/WunderAndroidTest
/features/step_definitions/home_step.rb
UTF-8
518
2.84375
3
[]
no_license
Given("that I fill in with three equal numbers") do @home = HomeScreen.new @home.fill_triangle(3,3,3) end When("a click in Calcular button") do @home.calculate_triangle end Then("I should see the result message as an equilateral triangle") do expect(@home.isEquilateral).to be true end Given("that I fill in w...
true
a8a4378e76c6886e4165ab5b3edf594506954405
Ruby
moskyt/urboretum-server
/vendor/cache/gems/haml-3.1.7/vendor/sass/lib/sass/tree/directive_node.rb
UTF-8
675
2.796875
3
[ "MIT" ]
permissive
# -*- encoding : utf-8 -*- module Sass::Tree # A static node representing an unproccessed Sass `@`-directive. # Directives known to Sass, like `@for` and `@debug`, # are handled by their own nodes; # only CSS directives like `@media` and `@font-face` become {DirectiveNode}s. # # `@import` and `@charset` are...
true
ff695158d4a2265aef49ed47e0a5751dee036671
Ruby
jdpaterson/ruby-math-game-
/game.rb
UTF-8
1,407
3.765625
4
[]
no_license
class Game attr_reader :player1 attr_reader :player2 attr_reader :round attr_reader :to_answer def initialize (player1, player2) @player1 = player1 @player2 = player2 @num_questions = 0 @to_answer = @player1 end def startGame askQuestion end def askQuestion @num_questions +=...
true
e157b982f258b417376eb5f8a3aab407cffa64f8
Ruby
Paul-Laffont/Ruby1
/exo_2.rb
UTF-8
88
3.21875
3
[]
no_license
puts "Quel est ton prénom ? : " first_name = gets.chomp puts "Bonjour, #{first_name} !"
true
0f3e99d588f39911b93f4a824b2009887775dbe7
Ruby
georgehwho/night_writer
/lib/file_manager.rb
UTF-8
561
3.265625
3
[]
no_license
class FileManager attr_reader :read, :write, :file def initialize(file_path, file_path_2) @read = file_path @write = file_path_2 parse_file end def parse_file read.nil? ? @file = '' : @file = File.read(read) end def write_file(input) return 'no file path gi...
true
2cada58e4edfcccc8b97cc87369be1fd1c6d043d
Ruby
UwanaIkaiddiSonos/my-actualize-repo
/object_oriented_ruby/store_item2.rb
UTF-8
937
3.046875
3
[]
no_license
require './store_module.rb' class Item attr_reader :type, :color, :price, :brand def initialize(input_options) #super @type = input_options[:type] @color = input_options[:color] @price = input_options[:price] @brand = input_options[:brand] @expiration = input_options[:expiration] end d...
true
569b28cbace31f3180f48b23d5d99ff5563c4611
Ruby
yutoJ/ruby_samples
/lib/checker/Regexp_checker.rb
UTF-8
366
3.125
3
[]
no_license
print 'Text?:' text = gets.chomp puts text begin print 'Pattern?:' pattern = gets.chomp puts pattern regexp = Regexp.new(pattern) rescue RegexpError => e puts "#{regexp} is not regexp" puts e.message puts e.backtrace retry end matches = text.scan(regexp) if matches.size > 0 puts "Matched: #{matches.j...
true
480742075db7fbc68dbe342c8a074c07d6c86e1e
Ruby
davidlares/ruby-overview
/hashes.rb
UTF-8
841
4
4
[ "MIT" ]
permissive
# son conocidos tambien como arreglos asociativos o diccionarios # los arreglos acceden a traves del indice -> en los hashes, son accesados a traves de objetos # poseen attr en formato clave, valor tutor = { 'nombre' => 'David', 'edad' => 26, 20 => 20, [] => "arreglo" } puts tutor puts tutor['nombre'] puts tut...
true
f184cddb754ce27c0958d6756ac73dc77fdb1370
Ruby
Renestl/AAO
/1 Intro/12_advanced_problems/exercises/5o_words.rb
UTF-8
364
4.625
5
[]
no_license
# Write a method o_words that takes in a sentence string and returns an array of the words that contain an "o". Use select in your solution! def o_words(sentence) words = sentence.split(" ") contain_O = [] words.select do |word| if word.include?("o") contain_O << word end end end print o_words("How did ...
true
f85cbdfa918b5dc3206b3956574e140a42696724
Ruby
wonderer80/bns_make
/app/models/bns_market.rb
UTF-8
1,272
2.59375
3
[]
no_license
require 'open-uri' class BnsMarket class << self def item_price(itemName) Rails.cache.fetch(itemName, expires_in: 1.minutes) do puts "#{itemName}: not cached" doc = Nokogiri::HTML(open("http://m.bns.plaync.com/bs/market/search?ct=&level=&stepper=&exact=1&sort=&type=&grade=&prevq=&q=#{URI.en...
true
f0a803bb903f955bbab2eda92410fd2797761d59
Ruby
aoch1019/reverse-each-word-prework
/reverse_each_word.rb
UTF-8
364
3.796875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# def reverse_each_word(sentence) # array1 = sentence.split(" ") # array2 = [] # # array1.each do |word| # array2.push word.reverse # end # return array2.join(" ") # end def reverse_each_word(sentence) reverse_each_word_helper(sentence.split(" ")).join(" ") end def reverse_each_word_helper(array) array....
true
092aa63fdfe6df0e1c7b04b27cbfab2c7a837266
Ruby
syook/potential-memory
/app/models/create_account.rb
UTF-8
679
2.6875
3
[]
no_license
class CreateAccount def initialize(params) @account_params = { subdomain: params.dig(:subdomain), business_name: params.dig(:business_name) } @user_params = { username: params.dig(:username), email: params.dig(:email), password: params.dig(:password) } end def save ActiveRecord::Ba...
true
5aec2cc4acba7c57acd2224a9606f76e1b8ae995
Ruby
rocky-jaiswal/gameoflife
/lib/gameoflife/neighbourhood.rb
UTF-8
1,556
3.53125
4
[]
no_license
require_relative 'matrix' require_relative 'cell' module Gameoflife class Neighbourhood def get_alive_neighbour_count(matrix, cell) neighbours = get_neighbours(matrix, cell) alive_neighbour_count = 0 neighbours.each do |cell| alive_neighbour_count = (alive_neighbour_count + 1) if ...
true
7ff924227d1e97650ff231dc6a595f8d60c1278d
Ruby
ollehhh/TAQC-Ruby-Retrainig
/models/user.rb
UTF-8
843
2.59375
3
[]
no_license
# frozen_string_literal: true require 'ffaker' # This class describes User Model class User attr_reader :username, :password, :firstname, :lastname, :email def initialize; end def generate_random_user @username = FFaker::Identification.ssn @password = FFaker::Internet.password @firstname = FFaker:...
true
a6dd32dedc7d893d228188506318a762a005857b
Ruby
dangroze/student-directory
/directory.rb
UTF-8
3,728
3.75
4
[]
no_license
@students = [] require 'csv' def input_students puts "Please enter the names of students" puts "To finish, hit return twice" name = STDIN.gets.chomp while !name.empty? do puts "Which cohort is the student in?" cohort = STDIN.gets.chomp if cohort == "" cohort = "Not assigned" else coh...
true
3d178a17e830a82cdeec49ed5667ea1f76a4699d
Ruby
mattkuo/codeeval
/medium/71.rb
UTF-8
514
2.9375
3
[]
no_license
#!/usr/bin/env ruby File.foreach(ARGV[0]) do |line| line.chomp! break if line.empty? nums, group = line.split(';') nums = nums.split(',').map(&:to_i) group = group.to_i result = [] group_index = group - 1 local_counter = group - 1 while group_index < nums.size group.times do result << num...
true
0b90bea273a42bc4cd63e3dc1ce1855c5d2bd822
Ruby
takayuki-ochiai/CodePractice
/RubyPractice/repeat_practice/step_meeting.rb
UTF-8
394
3.234375
3
[]
no_license
@memo = {} def step(rest_step, max_step) return 1 if rest_step == 0 return 0 if rest_step < 0 cnt = 0 (1..max_step).to_a.repeated_permutation(2) do |a, b| if @memo.has_key?(rest_step - a - b) cnt += @memo[rest_step - a - b] else tmp = step(rest_step - a - b, max_step) cnt += tmp ...
true
7d59f449e077b591ff063dad18496368964019d9
Ruby
sadfuzzy/download_images
/download_images/html_parser.rb
UTF-8
543
2.78125
3
[]
no_license
module DownloadImages class HtmlParser SEPARATORS = %w(" ' \() attr_reader :uri, :images_formats def initialize url @uri = URI.parse(url) @images_formats = YAML.load_file('formats.yaml')['images'] end def images_links source.scan(link_regexp) { |link| yield host_with(link) } ...
true
913cab7e072e1a3c5f8c4c35f498541a37bf3136
Ruby
ncbo/bioportal_web_ui
/app/helpers/ontology_metrics_helper.rb
UTF-8
1,694
2.609375
3
[ "BSD-2-Clause" ]
permissive
module OntologyMetricsHelper def format_metric_list(metrics, metric, title) return 0 if metric.nil? markup = "" # IF all of the classes triggered the metric, return the class count if metric.include?("alltriggered") markup = "#{metrics.numberOfClasses}" elsif metric.kind_of?(Array) && met...
true
b35af6e277043456cc14917e526c536665dd246a
Ruby
clarkee013/CCCaroke
/specs/guest_spec.rb
UTF-8
475
2.796875
3
[]
no_license
require ('minitest/autorun') require ('minitest/rg') require_relative ('../guest') class TestGuest < MiniTest::Test def setup() @guest1 = Guest.new("Damon", "Albarn", 5) @guest2 = Guest.new("Graham", "Coxon", 5) @guest3 = Guest.new("Alex", "James", 5) end def test_guest_has_first_name assert_e...
true
d339baae14b67d9975975b079475c4b856723abd
Ruby
tedlee/etsy-translate
/server/app.rb
UTF-8
1,256
2.734375
3
[]
no_license
require "sinatra" require "sinatra/contrib" require "google_fish" require "httparty" require "./etsy.rb" set :views, settings.root + "/views" # Route that accepts simple API queries get "/api/*" do listing_id = params[:q] lang = params[:lang] $shortened = false etsy_connection = Etsy.new response = etsy_connect...
true
01a4a5315ceb833d6f22a16f0ca4c1c4165c0165
Ruby
casperisfine/spy
/spec/spy/stub_implementation_spec.rb
UTF-8
1,712
2.921875
3
[ "MIT" ]
permissive
require 'spec_helper' module Spy describe Subroutine do class Bar def foo(given = nil) end end let(:obj) { Bar.new } describe "stub implementation" do describe "with no args" do it "execs the block when called" do Subroutine.new(obj, :foo).hook.and_return { :bar }...
true
03ce41e76dfadda9969f438f3ce071d6233631e5
Ruby
TataSher/bank_tech_test
/spec/statement_spec.rb
UTF-8
621
2.75
3
[]
no_license
# frozen_string_literal: true require 'statement' describe Statement do describe '#show' do it 'shows table head' do transfers = [{ date: '04/05/2021', credit: 500, debit: 0 }] statement = Statement.new(transfers) expect(statement.show).to include('date || credit || debit || balance') end ...
true
97482647a47cb3b78145cb2b4427a174a7ccfd74
Ruby
tony-gomes/backend_module_0_capstone
/day_7/10_little_monkeys.rb
UTF-8
1,709
4.40625
4
[]
no_license
def nursery_rhyme little_monkeys = ['Ten', 'Nine', 'Eight', 'Seven', 'Six', 'Five', 'Four', 'Three', 'Two'] little_monkeys.each do |chimp| puts "\n#{chimp} little monkeys jumping on the bed,\nOne fell off and bumped his head,\nMama called the doctor and the doctor said,\n\"No more monkeys jumping on the bed!\"...
true
0a4a2ad160007fcba6ce9605be14bf7eaa22105d
Ruby
ValerieMcCarthy/cartoon-collections-web-1116
/cartoon_collections.rb
UTF-8
523
3.375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def roll_call_dwarves (array_names) array_names.each_with_index do |value, index| puts "#{index+1}. #{value}" end end def summon_captain_planet (planeteer_calls) planeteer_calls.map! do |x| x.capitalize+"!" end end def long_planeteer_calls (calls) long_word = false calls.each do |x| if x.length > 4 ...
true
28f9af7c16035b8cdb9447cbe949b388d914d210
Ruby
lyntco/wdi_melb_homework
/homework/wk1d4-rental_app/main.rb
UTF-8
460
2.734375
3
[]
no_license
# THIS IS MAIN.RB require 'pry' require_relative 'tenant' require_relative 'apartment' require_relative 'building' jenny_details = { :name => 'Jenny', :age => 89, :gender => 'Male', :occupation => 'Works on the block', :is_funny => false } jenny = Tenant.new(jenny_details) apartment_details = { :room_num...
true
754191f62de79a9ddc71ecac2da8a9370ff82112
Ruby
abhinavsharma/project-euler
/ruby/7.rb
UTF-8
123
3.0625
3
[]
no_license
require 'mathn' n = 1 Prime.new.each do |i| if n == 10001 puts "the #{n} prime is #{i}" break end n += 1 end
true
b683ef389e549f0258151c4c7dd5fc160766292b
Ruby
lrs8810/module_3_diagnostic
/app/poros/member.rb
UTF-8
271
2.6875
3
[]
no_license
class Member attr_reader :name, :role, :house, :patronus, :id def initialize(member_hash) @id = member_hash['id'] @name = member_hash['name'] @role = member_hash['role'] @house = member_hash['house'] @patronus = member_hash['patronus'] end end
true
085dc025dc1cd1f47e69b3ea8880715912db660e
Ruby
evolve2k/spree-simple-product-coupons
/app/models/calculator/flat_percentage_specified_skus.rb
UTF-8
1,014
2.5625
3
[]
no_license
class Calculator::FlatPercentageSpecifiedSkus < Calculator preference :percentage_discount, :decimal, :default => 0 preference :skus_ids, :string, :default => 0 def self.description I18n.t("flat_percentage_specified_skus") end def self.register super Coupon.register_calculator(self) end ...
true
1e0d0b7211a25ddd0b0a6e80a4d3d4c5e9833a95
Ruby
mackuba/graphy
/spec/monitoring_set_spec.rb
UTF-8
3,420
2.6875
3
[ "MIT" ]
permissive
require 'spec_helper' describe Graphy::MonitoringSet do subject { Graphy::MonitoringSet.new(:memory) } it "should have no watches by default" do subject.watches.should == [] end describe "#name" do it "should return its name as string" do subject.name.should == "memory" end end describ...
true