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
dec97e691be75c1d9c2da92f5318262704e85351
Ruby
cornixxx/lesson2
/genie.rb
UTF-8
1,529
3.71875
4
[]
no_license
class Genie attr_accessor :health, :mood, :hunger, :asleep, :obedience, :magic def initialize(name) @name = name @health = 20 @mood = 10 @hunger = 10 @asleep = false @obedience = 20 @magic = 20 end def make_wish puts "You ask #{@name} to make one of your wishes come true." ...
true
31abc50eceaa2b5371f8503d68f1fc1d4c3ed5e0
Ruby
kmeyerhofer/Programming_and_Back-end_Development
/120_object_oriented_programming/lesson_4/easy_2/question_10.rb
UTF-8
673
3.203125
3
[]
no_license
# easier to pass information around the program # more concise code # more customization # less code duplication (DRY) # Creating objects allows programmers to think more abstractly about the code they are writing. # Objects are represented by nouns so are easier to conceptualize. # It allows us to only expose functio...
true
7eb22a02a2131de7fa3f0eb1b8581a6dec2c2147
Ruby
adrienfort/BonVoyage
/db/seeds.rb
UTF-8
8,556
2.734375
3
[]
no_license
require 'faker' require 'open-uri' puts "Building a huge seed ..." puts " - Destroying actual data ..." puts " destroying explorers and all their dependecies" Explorer.destroy_all puts " destroying artists and all their dependencies" Artist.destroy_all puts " DONE" puts " - Creating presentation explorer ...
true
f4bd2d205c726a8c02dfe558a243b59a5631d0ef
Ruby
nagachandrakn/Ruby-Fu
/countdown3.rb
UTF-8
98
3.265625
3
[]
no_license
#countdown3.rb x= gets.chomp.to_i for i in 1..x do puts x x-=1 end puts "Done!"
true
53a3b95da9f414a86f11e963d7b6d6479a4f7ce9
Ruby
Bl00d-Kirito/HSK-Cremisi_Portals_Demo
/Scripts/106 - PField_Time.rb
UTF-8
9,981
2.8125
3
[]
no_license
################################################################################ # * Day and night system ################################################################################ def pbGetTimeNow return Time.now end module PBDayNight HourlyTones=[ Tone.new(-142.5,-142.5,-22.5,68), # Midnight ...
true
75157d9146bb936bab748524df2fc8ccdf9a3c4e
Ruby
wied03/ansible-ruby
/lib/ansible/ruby/modules/generated/identity/keycloak/keycloak_clienttemplate.rb
UTF-8
3,248
2.515625
3
[ "BSD-2-Clause" ]
permissive
# frozen_string_literal: true # See LICENSE.txt at root of repository # GENERATED FILE - DO NOT EDIT!! require 'ansible/ruby/modules/base' module Ansible module Ruby module Modules # This module allows the administration of Keycloak client templates via the Keycloak REST API. It requires access to the REST...
true
b6cb7cc4fc0f87173048617a308499c1a318da25
Ruby
Vizzuality/cw-ndc-tracking
/app/models/static/target.rb
UTF-8
996
2.546875
3
[ "MIT" ]
permissive
module Static class Target include ActiveModel::Model include ActiveModel::Serialization attr_reader :title, :summary, :slug, :order, :indicators # @param target_config [Hash] # @option target_config :categories [Array<Hash>] def initialize(target_config) @title = target_config[:title] ...
true
bd3050ea454b4458b48e484c8feff39f62ec3ed1
Ruby
jakeheft/whether_sweater
/app/services/images_service.rb
UTF-8
411
2.546875
3
[]
no_license
class ImagesService def self.fetch_image(location) conn = Faraday.new('https://api.unsplash.com') do |f| f.headers['Accept-Version'] = 'v1' f.headers['Authorization'] = ENV['UNSPLASH_API_KEY'] end response = conn.get('/search/photos') do |req| req.params[:query] = "location: #{location}" end parsed_...
true
e1ad867ab8938c58af27fb41f9af3743ea7efeaa
Ruby
Reinoptland/week-1-codaisseur
/day4/dish.rb
UTF-8
242
3.265625
3
[]
no_license
class Dish def initialize(dish_name, ingredients, price) @name = dish_name @ingredients = ingredients @price = price end def name @name end def ingredients @ingredients end def price @price end end
true
fffa01e43845aae170285602eaa0b15b51f839c0
Ruby
StefansM/treecode
/TreeCode2/examples/3d-plasma-freq/parse_particles.rb
UTF-8
1,433
3.1875
3
[]
no_license
#!/usr/bin/env ruby require 'pp' require 'optparse' require 'matrix' class Options attr_accessor :dimensions, :timestep, :file def initialize @dimensions = 3 @timestep = 0 @file = nil end def self.parse return_opts = Options.new #Parse optional arguments opts = OptionParser.new do |opts| opts.ba...
true
8b7a21de1a167cea2044509cc6b93cdf99ffbfeb
Ruby
nicmlu/cartoon-collections-online-web-pt-100719
/cartoon_collections.rb
UTF-8
1,038
3.734375
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(dwarf_names) # print each name and index using puts dwarf_names.each.with_index(1) do |name, index| puts "#{index} #{name}" end end def summon_captain_planet(planeteer_calls) planeteer_calls.map do |call| call.capitalize! "#{call}!" end end def long_planeteer_calls(long_ca...
true
293453bbc189228a1d4f3134398d34cf2c0d8b77
Ruby
wolframkriesing/tic-tac-toe
/specs/winner_spec.rb
UTF-8
2,653
3.25
3
[]
no_license
require_relative "boards" require_relative "_helper" require_relative "_input_double" require_relative "../lib/player" require "minitest/autorun" class NoWinner < MiniTest::Unit::TestCase def test_empty_board_has_no_winner assert_equal Boards.empty_board.find_winner, nil end # rows def test_top_row_wo...
true
59e31994a04136c3061af84df7f73590fbb8c2c3
Ruby
DPNT-Sourcecode/CHK-kxrb01
/lib/solutions/CHK/checkout.rb
UTF-8
6,165
3.140625
3
[ "Apache-2.0" ]
permissive
# noinspection RubyUnusedLocalVariable class Checkout ITEMS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] PRICES = [{item: 'A', count: 1, price: 50}, {item: 'B', count: 1, price: 30}, {item: 'C', count: 1,...
true
313203a80649de920e3acaa550629d02f9ace559
Ruby
urbanadventurer/huginn
/app/models/agents/adioso_agent.rb
UTF-8
2,445
2.734375
3
[ "MIT" ]
permissive
module Agents class AdiosoAgent < Agent cannot_receive_events! default_schedule "every_1d" description <<-MD The Adioso Agent will tell you the minimum airline prices between a pair of cities, and within a certain period of time. The currency is USD. Please make sure that the difference betwee...
true
64a1cbb598a1196040cea94e6ef222a62d095039
Ruby
picatz/command_lion
/lib/command_lion/app.rb
UTF-8
10,552
2.921875
3
[ "MIT" ]
permissive
module CommandLion class App < Base def self.default_help(app) flagz = [] app.commands.each do |_, cmd| if cmd.options? cmd.options.each do |_, opt| if opt.flags? if opt.flags.long? flagz << opt.flags.short + opt.flags.long e...
true
d8c1410d1227853bd681cc169c88de522fb26cfa
Ruby
tokihiro000/AhoCorasick
/strutil.rb
UTF-8
1,358
3.390625
3
[]
no_license
require 'set' def GetExistStr count, file_name search_str_list = [] File.open(file_name) do |file| file.each_line do |str| str.chomp! search_str_list << str if search_str_list.length >= count break end end end return search_str_list end def GetRandomStr count, str_leng...
true
9cc9ec58496e547264b931052042cef5b4126093
Ruby
jthoenes/ips
/ips/src/main/ruby/lib/ext/assert_ext.rb
UTF-8
1,235
3.421875
3
[ "Apache-2.0" ]
permissive
# # Exension of the ruby base class +Object+ for enabling checking for assertions. # class Object # Basic assertion expecting the block passed to yield +true+, otherwise # an assertion error is raised. def assert unless yield # Cleaning the stack-trace from all assert methods, so it appears # the e...
true
9ec0f438df5a236615cdb96a87b27726931f3ae0
Ruby
hopsoft/model_definition_tester
/lib/model_definition_tester.rb
UTF-8
9,187
3.046875
3
[ "MIT" ]
permissive
class Test::Unit::TestCase IGNORE_PATTERN = /^(id|created_at|created_on|updated_at|updated_on|created_by|updated_by)$/i # This method provides a powerful yet simple way to test model definitions. It # verifies that the expected columns are supported, and that certain column # properties are enforced... such a...
true
11ad8973125138f131a1184cbc02cc052824c4c3
Ruby
theod07/project-euler
/problem_2.rb
UTF-8
776
4.34375
4
[]
no_license
# Project Euler # Problem 2 - Even Fibonacci numbers # Each new term in the Fibonacci sequence is generated # by adding the previous two terms. By starting with 1 # and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence # whose values do not...
true
95a563306826fc746a1ab9fdc84032618f035ebd
Ruby
leonimanuel/js-rails-as-api-pokemon-teams-project-online-web-sp-000
/pokemon-teams-backend/app/services/pokemon_serializer.rb
UTF-8
207
2.546875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class PokemonSerializer def initialize(pokemon_object) @pokemon = pokemon_object end def to_serialized_json options = { except: [:updated_at, :created_at] } @pokemon.to_json(options) end end
true
4a32ad5495c1255f5cbce1f227864240144a3c90
Ruby
mib32/tennis-rails
/app/models/wallet.rb
UTF-8
960
2.703125
3
[]
no_license
class Wallet < ActiveRecord::Base belongs_to :user has_many :deposits, dependent: :destroy has_many :deposit_requests, dependent: :destroy has_many :withdrawals, dependent: :destroy has_many :withdrawal_requests, dependent: :destroy def deposit_with_tax_deduction! amount deposit! amount - tax_for(amoun...
true
75d2d678c22f68e64851029fe1794f05b4964fa3
Ruby
queer1/imsg
/lib/imsg.rb
UTF-8
2,188
3.359375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require "imsg/version" require 'appscript' module ImsgHandler CHAT_DISPLAY_LIMIT = 12 class Chat attr_accessor :chat_number, :updated, :participants def initialize(chat_number, updated, participants) self.chat_number = chat_number self.updated = updated self.participants = particip...
true
df1ca8ff97ad6a90006a919ea3e3e73dd1f9397f
Ruby
ilocp/incident-locator
/app/behaviours/format_coordinates.rb
UTF-8
266
2.671875
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# # Defines common location callbacks for models # module FormatCoordinates def round_coordinates # round lat/lng to 7 decimal digits (cm precision) self.latitude = self.latitude.round(7) self.longitude = self.longitude.round(7) end end
true
aa58360002f803ac728a73e252f78bd57ea45ed5
Ruby
djspinmonkey/testify
/samples/summary.rb
UTF-8
406
2.75
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# Output a summary of the test results after they've all been run. # class Summary include Testify::Middleware aka :summary def call( env ) results = @app.call(env) summary = Hash.new(0) results.each { |res| summary[res.status] += 1 } puts "Ran #{results.size} tests in all" summary.each {...
true
2d639011b3a33ba30d2db3604d95841d9fa9a07c
Ruby
PlushNinja/stellar
/app/models/transfer.rb
UTF-8
6,157
2.59375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Transfer < ApplicationRecord resourcify include Authority::Abilities include Trackable #--- belongs_to :store # Transfers happen from source to destination, either of which may be nil # for a one-sided transfer (from purchases/orders). belongs_to :source, class_name: 'Inventory', optional: true...
true
05f0100b010d1c32ab9f2d9ef626bdc8d8c4a046
Ruby
itggot-hannes-skoog/standard-biblioteket
/lib/min_of_three.rb
UTF-8
440
4.5
4
[]
no_license
# Public: Takes three numbers and outputs smallest of the three. # # num1 - First number. # num2 - Second number. # num3 - Third number. # # Examples # # min_of_three(7,12,2) # # => 2 # # Returns smallest of three numbers. def min_of_three(num1, num2, num3) if num1 < num2 if num1 < num3 ...
true
d891433596496e631e4bb97e37e81a7017afa780
Ruby
sansuaza/RubyUdemy
/section8/Spaceship_Operator.rb
UTF-8
175
2.796875
3
[]
no_license
# Se comparan dos elementos si l la der es mayor, retorna -1 # de lo contrario 1, si son iguales 0 # Con arreglos los compara todos 4 <=> 5 => -1 4 <=> 3 => 1 4 <=> 4 => 0
true
20dc871f6bea6130cfdd2c1c75ef586f4cd07ce5
Ruby
sf-wdi-22-23/23-homework
/BreanaMarie/breana-zombies.rb
UTF-8
2,252
2.671875
3
[]
no_license
Level 1 #Find $ Zombie.find(1) #<Zombie id: 1, name: "Ashley", graveyard: "Glen Haven Memorial Cemetery"> Successfully found Zombie where ID = 1. #Crete $ Bill = Zombie.create #FindII $ Zombie.last #<Zombie id: 3, name: "Katie", graveyard: "My Father's Basement"> Found the last Zombie! #Query #<ActiveRecord::Relation [...
true
c664a9604a559e90237f097a65751dda9c95a5f0
Ruby
djlazz3/hyperledger-fabric-sdk
/lib/fabric_ca/error.rb
UTF-8
291
2.59375
3
[ "MIT" ]
permissive
module FabricCA class Error < StandardError attr_reader :response, :full_message def initialize(message, response) super message @response = Hashie::Mash.new JSON.parse(response.body) @full_message = @response.errors.map(&:message).join(', ') end end end
true
0512d145e35d90c9f6c0254aa0b6f5ae40f31971
Ruby
LincolnWilliam/curso_ruby
/modulo1/loops/each.rb
UTF-8
429
3.78125
4
[]
no_license
#Sintaxe each # cada #itera ranges (1..5).each do |i| puts "o valor de i é: #{i}" end #itera arrays ["banana", "maçã", "mamão"].each do |fruta| puts "a fruta é #{fruta}" end #itera hashes {a: "banana", b: "maçã", c: "mamao"}.each do |fruta| puts "a fruta é #{fruta.last}" end #### ...
true
62772b3bf95b4ce1a70f2b46388811e4e5f2f58e
Ruby
IciredAtenllado/sample_app
/app/helpers/application_helper.rb
UTF-8
361
2.625
3
[ "MIT", "Beerware", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module ApplicationHelper # Returns the full title on a per-page basis. # Documentation comment def full_title(page_title = '') # Method def, optional arg base_title = "Ruby on Rails Tutorial Sample App" # Variable assignment if page_title.empty? # Boolean test base_title # Implicit return else page_title + " | " + base...
true
7769a8fc84cafd46a3db414136b25390b3483480
Ruby
MagneticRegulus/120_exercises
/basics_4/2_choose_right_method.rb
UTF-8
573
3.40625
3
[]
no_license
# Add the appropriate accessor methods to the following code. class Person attr_writer :name, :phone_number attr_reader :name end person1 = Person.new person1.name = 'Jessica' person1.phone_number = '0123456789' puts person1.name # OR class Person attr_accessor :name, :phone_number end person1 = Person.new p...
true
6b3e68b1e04865e2e4c17dac28fb2e1c4be34f46
Ruby
princesspretzel/euler
/ruby/10.rb
UTF-8
229
3.4375
3
[]
no_license
# The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. # Find the sum of all the primes below two million. require 'prime' sum = 0 (1..2000000).step(2) do |x| if Prime.prime?(x) sum += x end end sum+2 # 142913828922
true
b420f9ec6ee42f8f75f45890d03e533c499baa0d
Ruby
jaimeiniesta/DroidTimeLapse
/droidtimelapse.rb
UTF-8
1,322
3.375
3
[ "MIT" ]
permissive
########################################################################## # DroidTimeLapse # A tiny little script to take photos from android on a specified interval ########################################################################## # Define dirs and constants APP_DIR = File.expand_path File.dirname(__FILE__)...
true
82700913fa29038ef0ed899f158e9425ce1cdf00
Ruby
siwS/bowling-game-tdd-kata
/spec/game_spec.rb
UTF-8
1,390
3.09375
3
[]
no_license
require_relative "../lib/game" describe Game do describe "#roll" do it "responds to #roll" do game = Game.new expect(game).to respond_to(:roll) end end describe "#score" do it "responds to #roll" do game = Game.new expect(game).to respond_to(:score) end it "all miss...
true
ac90ba44eab6935872fe1e65c9007888662d80da
Ruby
KP09/logbook-api
/db/seeds.rb
UTF-8
551
2.734375
3
[]
no_license
puts "Destroying previous passages" Passage.destroy_all puts "Seeding new passages..." 10.times do Passage.create!({ departure_port: "Some departure port", arrival_port: "Some arrival port", departure_date: Date.today-100, arrival_date: Date.today-90, description: "A really awesome passage. We le...
true
23a7a375600501d0c4cd1c1dee57080f2fd96e3e
Ruby
ziobrando/da_beat
/test/clock/clock_spec.rb
UTF-8
797
2.53125
3
[]
no_license
$:.unshift File.join(File.dirname(__FILE__), "../..", "lib") require "rspec" require "clock/clock" describe "Tick" do it "should tick at a given interval" do end it "should accept listeners" do clock = Clock.new 20,5 listener = MockListener.new clock.add_listener listener clock.start li...
true
67ef3dd8a877a183eb990de70107341ab5c9b77b
Ruby
toshimaru/jekyll-toc
/test/parser/test_invalid_options.rb
UTF-8
883
2.75
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'test_helper' class TestInvalidOptions < Minitest::Test BASE_HTML = '<h1>h1</h1>' EXPECTED_HTML = <<~HTML.chomp <ul id="toc" class="section-nav"> <li class="toc-entry toc-h1"><a href="#h1">h1</a></li> </ul> HTML def test_option_is_nil parser = Jekyll::Tab...
true
65301dc2e9eeb2ea5728942f4b1bcdba85eb3007
Ruby
anette87/bringing-it-all-together-onl01-seng-ft-050420
/lib/dog.rb
UTF-8
2,585
3.390625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Dog attr_accessor :name, :breed, :id def initialize(keyvalues_hash) @id = keyvalues_hash[:id] @name = keyvalues_hash[:name] @breed = keyvalues_hash[:breed] end def self.create_table sql = <<-SQL CREATE TABLE IF NOT EXISTS dogs( id INTEGAR ...
true
84829f0f804157cd737bccc43091fe39e796aaaa
Ruby
newtonry/interview-street
/fraud-prevention.rb
UTF-8
1,856
3.265625
3
[]
no_license
def fraud_checker deals = {} frauds = [] num_input = gets.chomp.to_i num_input.times do inp = gets.chomp.split(',') deal_id = inp[1] entry = {} entry[:ord_id] = inp[0] entry[:email] = process_email(inp[2]) entry[:full_address] = full_add(inp[3], inp[4], inp[5], inp[6]) entry[:cr...
true
4e11a4a0f3006b10292dc2cacb5ad68661c3106d
Ruby
tommoor/filecop
/lib/filecop/runner.rb
UTF-8
576
2.53125
3
[ "MIT" ]
permissive
module Filecop class Runner def initialize(paths) @paths = paths end def run # load banned patterns from config file patterns = JSON.parse File.read(File.join(File.dirname(__FILE__), '..', 'patterns.json')) rules = patterns.map { |o| Rule.new(o) } output = [] @paths.e...
true
0325102813962b762dbb41c74d1e8ef996ea9268
Ruby
zoebisch/artist-song-modules-v-000
/lib/concerns/memorable.rb
UTF-8
283
2.625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
module Memorable module ClassMethods def reset_all self.all.clear end def count self.all.count end end module InstanceMethods #Did it both ways, here and in paramable def to_param self.name.downcase.gsub(' ', '-') end end end
true
622e77b2f44bd529171a71520dda5d7ea5a70ab0
Ruby
AdelineAdy/Exos_Ruby
/exo_17.rb
UTF-8
253
3.734375
4
[]
no_license
puts "Quel est votre age?" print ">" age = gets.chomp.to_i year = 2020 - age minage = 0 while (year <= 2020) if age / 2 == minage puts "Il y a #{2020 - year} ans, tu avais la moitié de l'âge que tu as aujourd'hui." end minage += 1 year += 1 end
true
c02468457f7c9bf283675c63374e6a4bf5504d4d
Ruby
jasoncorum/ga_bewd
/Students/Andrew_Doepping/secret_number.rb
UTF-8
1,051
4.03125
4
[]
no_license
secret_number = rand(11) def intro puts "So, who wants to challenge Camacho to a game of Secret Number?" player_name = gets.chomp puts "Woah #{player_name} ! You're about to play mental ninjitzu!" puts "Let's layout the rules. I gots myself a number, and you need to figure out what it is in three tries." puts ...
true
a852b2d0f134ede582d60c20e896b242eb6e927d
Ruby
alvaritog/openlocs_app
/db/seeds.rb
UTF-8
1,310
2.5625
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
72ba02bd08d4e8857d2a1ba15af8b874873c13b9
Ruby
jimmy2/launchschool_intro_to_programming
/hashes/exercise_02.rb
UTF-8
346
2.875
3
[]
no_license
hash_01 = { shawshank_redemption: 9.2, the_godfather: 9.2, the_dark_knight: 9.0, twelve_angry_men: 8.9 } hash_02 = { shindlers_list: 8.9, pulp_fiction: 8.9, lotr: 8.9, fight_club: 8.8 } hash_01.merge(hash_02) puts "Using merge" puts hash_01 puts hash_02 hash_01.merge!(hash_02) # mutates the caller puts "Using merge!"...
true
ddf8cd7cbe4493c188f771d3f801f4a30b576c22
Ruby
abishekaditya/RubyProjects
/pry
UTF-8
82
2.765625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'pry' a = 50 binding.pry if a > 20 puts a - 50 end
true
aa5027dd3788ef6d06b436a7365940d3e3a3cbe5
Ruby
marcwright/WDI_ATL_1_Instructors
/REPO - London/0_Homeworks/sinatra__calcit/calcit_sinatra/main.rb
UTF-8
2,277
2.765625
3
[]
no_license
require 'sinatra' require 'sinatra/reloader' if development? require 'pry-byebug' get '/' do erb :home end get '/simple' do @first = params[:first].to_f @second = params[:second].to_f @operator = params[:operator].to_s @result = case @operator when '+' then @first + @second when '-' then @f...
true
51c8f40d9590af0796fba4bc6e84e38dc2bdaa4d
Ruby
kukushkin/mimi
/lib/mimi/cli/template/spec/support/envvars.rb
UTF-8
371
2.578125
3
[ "MIT" ]
permissive
require 'dotenv' # Runs block with ENV variables loaded from specified file, # restores original ENV variables after. # # @example # with_env_vars('.env.test') do # application.config.load # end # def with_env_vars(filename = nil, &_block) original_env_vars = ENV.to_hash Dotenv.load(filename) if filename ...
true
050d84cb16ad0d5b0f028d5c03da648064624be1
Ruby
JonathanSR/flashcards
/test/card_test.rb
UTF-8
574
3
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/card' require 'pry' class CardTest < Minitest::Test def test_does_card_exist card = Card.new("What is the capital of Alaska?", "Juneau") assert_equal Card, card.class end def test_does_card_have_a_question card = Card.new("What is t...
true
31c626432f6972b2ef3f9049621e314496b84ddc
Ruby
MichaelSchwar3/AoC
/day1/part1.rb
UTF-8
114
3.265625
3
[]
no_license
f = File.new("input.txt") arr = [] f.each_line do |num| n = num.chomp.to_i arr << n end p arr.reduce(:+)
true
331ef5afa8c629daaa13faae4b72dcb62a101f97
Ruby
kumaranvpl/rbnd-udacitask-part2
/lib/listable.rb
UTF-8
632
2.921875
3
[]
no_license
module Listable def format_description(description) "#{description}".ljust(25) end def format_priority(priority) value = " ⇧".colorize(:red) if priority == "high" value = " ⇨".colorize(:yellow) if priority == "medium" value = " ⇩".colorize(:green) if priority == "low" value = "" if !priority ...
true
2c1259cda1065f9427ec0078033adb1323e9a807
Ruby
yusukeyamane/vending-machine
/VendingMachine.rb
UTF-8
1,284
3.671875
4
[]
no_license
class Beverage @@tax = 0.1 attr_reader :name, :price def initialize(args) @name = args.fetch(:name, 'サイダー') @price = args.fetch(:price, 120) end def price @price + (@price * @@tax).floor end end class VendingMachine def initialize(products) @products = products end def transaction...
true
5baa6e24892c9ec6f3787048e58ad4a79e26a220
Ruby
scpike/rails-units
/lib/rails_units/unit_definitions.rb
UTF-8
13,712
2.515625
3
[ "MIT" ]
permissive
class Unit < Numeric UNIT_DEFINITIONS = { # prefixes '<googol>' => [%w{googol}, 1e100, :prefix], '<kibi>' => [%w{Ki Kibi kibi}, 2**10, :prefix], '<mebi>' => [%w{Mi Mebi mebi}, 2**20, :prefix], '<gibi>' => [%w{Gi Gibi gibi}, 2**30, :prefix], '<tebi>' => [%w{Ti Tebi tebi}, 2**40, :prefix], '<pebi>' ...
true
e380b52056bcc77fe53a85ad663f1fc22604fb86
Ruby
sunrick/tiy-homework
/tic-tac-toe/test.rb
UTF-8
1,768
3.234375
3
[]
no_license
require 'minitest/autorun' require './game' require './computer' require './human' require './board' require './validation' require './format' include Validation include Format class GameTest < MiniTest::Test def test_can_make_game game = Game.new(Human.new("Rick"),Computer.new("John"),[3,3]) assert_...
true
107e88fd17d45cffd4b1d37e738e9c5dd7b0c7fa
Ruby
himynameisjonas/timber-ruby
/lib/timber/util/hash.rb
UTF-8
880
3.0625
3
[ "ISC" ]
permissive
module Timber module Util # @private module Hash SANITIZED_VALUE = '[sanitized]'.freeze extend self # Deeply reduces a hash into a new hash, passing the current key, value, # and accumulated map up to that point. This allows the caller to # conditionally rebuild the hash. ...
true
e9f764b5a98b86f3a627f41ef0dca185313c8d2f
Ruby
tolsen/rubydav
/lib/rubydav/auth_world.rb
UTF-8
5,497
2.75
3
[]
no_license
# $Id$ # $URL$ require 'bsearch' require 'uri' module RubyDav # represents a set of protection spaces for a request object class AuthWorld def initialize @spaces = [] end def get_auth url, client_opts l = @spaces.bsearch_lower_boundary { |x| x.prefix <=> url } # skip the one fou...
true
72e3348403ea8802e0e89e0d03a8156134d9dd33
Ruby
b09/project_dashboard
/models/project.rb
UTF-8
1,745
3.09375
3
[]
no_license
require_relative('../db/sql_runner') class Project attr_reader :id attr_accessor :name, :budget, :start_date, :type, :description def initialize(options) @id = options['id'].to_i if options['id'] @name = options['name'] @budget = options['budget'].to_i @type = options['type'] @start_date = opti...
true
cce8620540a30956e3058f6d6c5c7323dfbd986d
Ruby
dcoleman21/BattleShip
/lib/game.rb
UTF-8
5,116
3.65625
4
[]
no_license
require './lib/ship' require './lib/cell' require './lib/turn' require './lib/player' require './lib/board' require "pry" class Game attr_reader :computer_player, :human_player, :computer_ships_sunk, :human_ships_sunk def initialize(computer, human) @computer_player ...
true
330b047e829de1cd9b5161987d60b1f4f5c967ae
Ruby
dnnnn-yu/session_old
/app/models/concerns/master.rb
UTF-8
1,339
2.71875
3
[]
no_license
module Master PREFECTURES = { 北海道: 1, 青森県: 2, 岩手県: 3, 宮城県: 4, 秋田県: 5, 山形県: 6, 福島県: 7, 茨城県: 8, 栃木県: 9, 群馬県: 10, 埼玉県: 11, 千葉県: 12, 東京都: 13, 神奈川県: 14, 新潟県: 15, 富山県: 16, 石川県: 17, 福井県: 18, 山梨県: 19, 長野県: 20, 岐阜県: 21, 静岡県: 22, 愛知県: 23, 三重県: 24, 滋賀県: 25, 京都府: 26, 大阪府: 27, 兵庫県: 28, 奈良県: 29, 和歌山県: 30, 鳥...
true
adb43ef47ef707cf33b75ccea6288ca3540c9b8b
Ruby
ccallebs/Moon-Critter
/lib/map.rb
UTF-8
924
3.234375
3
[]
no_license
require 'gosu' require './lib/map_tile' class Map attr_accessor :window, :tiles def initialize(window) @window = window @char_map = [] populate_world_map build_tiles end def draw horizontal_tiles = 800 / 50 vertical_tiles = 800 / 50 horizontal_tiles.times do |x| vertical_t...
true
a127e96b5f40b8bd45b0c089a81a63c37022ec47
Ruby
Skeyelab/enoCards
/db/seeds.rb
UTF-8
7,081
2.78125
3
[]
no_license
EnoCard.create!([ {text: "Abandon normal instruments"}, {text: "Accept advice"}, {text: "Accretion"}, {text: "A line has two sides"}, {text: "Allow an easement (an easement is the abandonment of a stricture)"}, {...
true
ef31864d341fe7258b67351cb1d7479cbd6f857b
Ruby
trouni/batch-303
/reboot/instacart/instacart_2_with_qty.rb
UTF-8
1,421
3.921875
4
[]
no_license
# 1. Decide where to ask for qty # 2. Ask for the qty to the user using qty = gets.chomp and store it # 3. Store the item & qty in the hash: cart[item] = qty # 4. Display the details of the bill store = { kiwi: 390, banana: 100, grapefruit: 1590, grapes: 50 } # cart = [] cart = {} # key: item, value: qty put...
true
4d41162bc94c63650830eea01556b1dabb84e801
Ruby
SylviaChoong/calculator
/calculator.rb
UTF-8
2,282
4.65625
5
[]
no_license
require "byebug" # Building a working calculator with functions +, -, *, / # Print a string to ask for user first input number # Print a list to ask user if he wants to add, substract, multiply, divide or equalize the equation # IF user adds, ask for an input number and puts added number # ELSIF user substracts, ask fo...
true
e465981172c393a212c94c889e34ed58ac8b3554
Ruby
CristianCurteanu/proz-scrapper
/lib/proz/parser.rb
UTF-8
1,531
2.625
3
[]
no_license
# frozen_string_literal: true require 'open-uri' require 'nokogiri' module Proz class Parser extend ModelAttribute attribute :source attribute :first_name attribute :last_name attribute :country attribute :native_language attribute :target_language def initialize(url) self.so...
true
a9c946e4d089f165014de23001b10ac401814882
Ruby
surfacedamage/pairing-config
/Rakefile
UTF-8
1,699
2.921875
3
[ "MIT" ]
permissive
require 'rubygems' require 'rake' desc "attempt to symlink all dot files from the current user's home directory" task :symlink do symlink(:skip => '.gitconfig') end namespace :symlink do desc "symlink all dot files (including .gitconfig) from the current user's home directory" task :pairing do symlink end...
true
c0f802aad0a2a5b37eea3d9a6946d3a40a031cec
Ruby
Ric-Lavers/slotwars
/slotwars/app/models/slot.rb
UTF-8
619
2.75
3
[]
no_license
class Slot < ApplicationRecord def initialize @q = "bb-8.png" @k = "porg.png" @a = "bad_guy.png" @cards = [@q,@k,@a] @totalscore = 0 end def spin result = [] (0..2).each{|card| result << @cards.sample } @result = result end def score if @result == [@a,@a,@a] ...
true
ab0de473061f57bb3f8f76d60af255a254bef91f
Ruby
LHJE/war_or_peace_redux
/test/deck_test.rb
UTF-8
1,516
3.328125
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/card' require './lib/deck' class DeckTest < Minitest::Test def setup @card_1 = Card.new(:diamond, 'Queen', 12) @card_2 = Card.new(:heart, 'Ace', 14) @card_3 = Card.new(:spade, 'Three', 3) @card_4 = Card.new(:club, 'four', 4) @card...
true
9c316a286c3855bda7f2f204aedb24ee1e59c800
Ruby
mepiphany/scraper_rails_api_jungle
/app/services/scraper.rb
UTF-8
1,402
2.75
3
[]
no_license
require 'open-uri' require 'nokogiri' class Scraper attr_reader :asin, :doc include ProductInformationAttr include CategoryBaseInformationAttr include CategorySubInformationAttr def initialize(asin) @asin = asin @doc = Nokogiri::HTML(open("https://www.amazon.com/dp/#{asin}")) end def create_reco...
true
ba54dc72262eeff120101877e6476d2fd0b8dfd4
Ruby
RomanPlyazhnic/practice_parce
/app/controllers/main_controller.rb
UTF-8
1,624
2.640625
3
[]
no_license
require './lib/classes/PageDownloader' require './lib/classes/Parser' require './lib/classes/GenresStorage' require 'kaminari' class MainController < ApplicationController helper QueryHelper def index @genres = GenresStorage.genres @animes = anime_selector(@animes, params) end def search @genres ...
true
05069188d70bf9bedba8a55d2cc0be0ea465876e
Ruby
Canar/pulseaudio_simple_ffi
/lib/pulseaudio_simple_ffi.rb
UTF-8
2,939
2.53125
3
[]
no_license
#!/usr/bin/env ruby require 'ffi' module PulseAudioSimpleFFI extend FFI::Library ffi_lib 'pulse-simple' class IntPtr < FFI::Struct layout :value, :int end enum :sample_format, [ :u8, :alaw, :ulaw, :s16le, :s16be, :f32le, :f32be, :s32le, :s32be, :s24le, :s24be, :s2432le, :s2432b...
true
53969eb9d59aa8cabf35d5ff3d8bd2c01f2b3e89
Ruby
hilben/ffi_rust
/test.rb
UTF-8
405
2.546875
3
[]
no_license
require "ffi" module Rust extend FFI::Library ffi_lib "target/release/test.dll" ffi_convention :stdcall attach_function :square, [:int ], :int end module Win32 extend FFI::Library ffi_lib 'user32' attach_function :messageBox, :MessageBoxA,[ :pointer, :string, :string, :long ], :int end Win32....
true
42efb986fd698f0e974ecc7c0244c507bd8ca46e
Ruby
npl22/dynamic-array
/lib/queue_with_max.rb
UTF-8
1,248
3.859375
4
[]
no_license
require_relative 'ring_buffer' class QueueWithMax attr_accessor :store, :maxqueue def initialize @store = RingBuffer.new @maxqueue = RingBuffer.new end # Only 2 pushes, so it's constant, not with respect to O(n) def enqueue(el) @maxqueue.push(el) if @maxqueue.length.zero? @store.push(el) ...
true
7180f4c910b4ecddce9dfd7bf28c9b51a7f0ebc4
Ruby
kindrowboat/hexflex
/lib/hexflex/glue_template.rb
UTF-8
1,382
2.78125
3
[ "MIT" ]
permissive
require 'hexflex/base_template' require 'hexflex/triangle_grid' require 'hexflex/rvg_template_vectorizer' require 'hexflex/triangle' module Hexflex class GlueTemplate < BaseTemplate def make_vector RvgTemplateVectorizer.new(triangle_grid).vectorize end private def triangle_grid Triangl...
true
f18e1ced43673285a94f1799f0b0d6472bd9c9f4
Ruby
rachel1032/kwk-l1-say-hello-methods-ruby-kwk-students-l1-bos-070918
/say_hello.rb
UTF-8
278
3.96875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Build your say_hello method here your_name = ("Nimisha") my_name = ("Rachel") def say_hello1 (your_name, my_name) puts "Hello #{your_name}! I'm #{my_name}" end say_hello1("Nimisha","Rachel") def say_hello (name = "Ruby Programmer") puts "Hello #{name}!" end say_hello
true
4366aa2a4738b28f9f8e8740a6e93a7bfcfd472b
Ruby
rosyatrandom/ruby-code-line-counter
/lib/predicates_checker.rb
UTF-8
503
3.03125
3
[]
no_license
require_relative 'counter' class PredicatesChecker def initialize @checks = {} end def []= name, check @checks[name] = check end def check_item item @checks.transform_values { |check| check.call item } end def counts_for items items .map { |item| check_item item } .each_wit...
true
6a794722a00ec4b77a18808b6495024c08545991
Ruby
dalibor/bitfields
/spec/bitfields_spec.rb
UTF-8
13,317
2.671875
3
[ "MIT" ]
permissive
require 'spec_helper' class User < ActiveRecord::Base include Bitfields bitfield :bits, 1 => :seller, 2 => :insane, 4 => :stupid end class UserWithBitfieldOptions < ActiveRecord::Base include Bitfields bitfield :bits, 1 => :seller, 2 => :insane, 4 => :stupid, :scopes => false end class MultiBitUser < ActiveR...
true
b72c2cdbed9d7310104cdd64e394c60b577a0491
Ruby
aliashafi/W4D4
/TDD/spec/tdd_prac_spec.rb
UTF-8
1,048
2.890625
3
[]
no_license
require "tdd_prac" RSpec.describe Array do describe "Array#my_uniq" do subject(:arr) {[1,2,3,3,2]} subject(:answer) { arr.my_uniq } it "returns an Array" do expect(answer).to be_a(Array) end it "has no duplicates" do expect(answer.count(3)).to eq(1) end it "should retur...
true
145212972a07f939bc1b9f3ebb2f7365ef266e3d
Ruby
department-of-veterans-affairs/ruby-bgs
/lib/bgs/services/rating_profile.rb
UTF-8
1,769
2.578125
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
# As a work of the United States Government, this project is in the # public domain within the United States. # # Additionally, we waive copyright and related rights in the work # worldwide through the CC0 1.0 Universal public domain dedication. module BGS # Used for finding information about specific ratings clas...
true
0bd5f798042d3180481e99818c95ad1c0a555710
Ruby
norchow/conversor_monedas
/src/conversor.rb
UTF-8
1,729
3.703125
4
[]
no_license
class MoneyAmount attr_accessor :amount, :currency def initialize(amount, currency) self.amount = amount self.currency = currency end def equals(another_amount) self.amount == another_amount.amount && self.currency == another_amount.currency end def *(coefficient) ...
true
02f9ea52354eb0a1272b5d931d5fbb474b2917e9
Ruby
AlexanderCleasby/dice-roll-ruby-online-web-prework
/dice_roll.rb
UTF-8
251
3.859375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Create method `roll` that returns a random number between 1 and 6 # Feel free to google "how to generate a random number in ruby" def roll # answer using ranges #rand(6)+1 #answer using arrays values = [1,2,3,4,5,6] values[rand(6)] end
true
6ac4c92852ba5b1c758fb8fbe1d1edda97c51412
Ruby
meliew/anagram-detector-online-web-pt-051319
/lib/anagram.rb
UTF-8
190
3.0625
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Anagram attr_accessor :word def initialize(word) @word = word end def match(words) words.keep_if do |string| word.split('').sort == string.split('').sort end end end
true
6be9864a261dda8a3d79ee6e869fa349467d0023
Ruby
yinm/ruby-book-codes
/sample-codes/chapter_04/code_4.05.02.rb
UTF-8
448
3.5
4
[]
no_license
# 不等号を使う場合 def liquid?(temperature) # 0度以上100度未満であれば液体、と判定したい 0 <= temperature && temperature < 100 end liquid?(-1) #=> false liquid?(0) #=> true liquid?(99) #=> true liquid?(100) #=> false # 範囲オブジェクトを使う場合 def liquid?(temperature) (0...100).include?(temperature) end liquid?(-1) #=> false liquid?(0) #=> tr...
true
c8213821acf44d52f4dc3f4ed14fe1f49e528d97
Ruby
teoucsb82/pokemongodb
/lib/pokemongodb/pokemon/metapod.rb
UTF-8
1,294
2.703125
3
[]
no_license
class Pokemongodb class Pokemon class Metapod < Pokemon def self.id 11 end def self.base_attack 56 end def self.base_defense 86 end def self.base_stamina 100 end def self.buddy_candy_distance 1 end ...
true
71bb9817094cee78023e2da50f17149513800295
Ruby
mendeza428/rockpaperscissors
/spec/db_spec.rb
UTF-8
889
2.59375
3
[]
no_license
require 'spec_helper' require './lib/rps.rb' include RPS describe "db" do it "exists" do expect(DB).to be_a(Class) end it "returns a db" do expect(RPS.db).to be_a(DB) end it "is a singleton" do db1 = RPS.db db2 = RPS.db expect(db1).to be(db2) end describe "users in db" do let(:...
true
c44a73e5fdba830de4c9e707df8da636deb2958c
Ruby
developersbk/Universal_Code_Snippets
/Codes/Ruby/Algorithms/bst.txt
UTF-8
553
3.4375
3
[]
no_license
module BST Node = Struct.new(:value, :parent, :left, :right) # Finds the 'next' node (in-order successor) of a given node in a binary search tree, # see examples in test/bst_test.rb def self.find_next(node) return nil if node.nil? # find the left most node in the right subtree if node.right ...
true
e2fb324db56a52463a5294e31a8cc1e413b5275b
Ruby
IonatanMocan/Learn-Ruby-the-hard-way
/lifetime_left.rb
UTF-8
965
4.125
4
[]
no_license
puts "You think you have all the time in the world? Ha." puts "I don't are how old are you, but till what age would you want to live?" expected_years = $stdin.gets.chomp.to_i puts "I can tell you how many days and hours you have left till that day" puts "What is your birth year" birth_year = $stdin.gets.chomp.to_i p...
true
1977a40aabc24477efd4b8c313fc646f2577a83c
Ruby
zulfikar4568/ruby-language
/02.strukturKontrol/09.forLoops/main.rb
UTF-8
123
3.28125
3
[]
no_license
for i in 1..10 # break if i>10 next if i==2 puts i end x = 0 loop do puts x x+=1 break if x>10 end
true
e32e6a72bdb473401c1f25ec5ad19af0f364784e
Ruby
thomasbeckett/sparta_stuff
/week-8/oop-refresher/shrubs/rhododendron.rb
UTF-8
328
2.953125
3
[]
no_license
require_relative "../plant.rb" require_relative "../plant_types/shrubs.rb" class Rhododendron < Plant include Shrub def color puts "pink" end def location puts "I am found in asia" end def height Size.height end def stems CommonTraits.stems end end steve = Rhododendron.new steve...
true
6aad3546f3caaa2cf60ca2f65a03fd2e5352637f
Ruby
AJDot/Launch_School_Files
/120_Object_Oriented_Programming/LS_Book_OOP_in_Ruby/The_Object_Model/exercises.rb
UTF-8
979
4.375
4
[]
no_license
puts "------------" puts "Exercise 1" puts "------------" # How do we create an object in Ruby? Give an example of the creation of an object. # ANSWER # An object is by using the #new method on a class. A class is defined using the 'class' reserved word like a method using 'def' class House end # the object 'my_h...
true
da43bfe6c0997ba03d89ea199efe711c8222f838
Ruby
alto/aasm
/spec/unit/simple_example_spec.rb
UTF-8
1,621
2.6875
3
[ "MIT" ]
permissive
require 'spec_helper' class Payment include AASM aasm do state :initialised, :initial => true state :filled_out state :authorised event :fill_out do transitions :from => :initialised, :to => :filled_out end event :authorise do transitions :from => :filled_out, :to => :authorise...
true
bb0da92d9bff94e82f21e4eeb00fda8043752c2f
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/roman-numerals/3afc8fcb62434147a7f70089c8e31156.rb
UTF-8
1,727
3.9375
4
[]
no_license
class Fixnum def to_roman roman_numbers = { 1 => 'I', 4 => 'IV', 5 => 'V', 9 => 'IX', 10 => 'X', 40 => 'XL', 50 => 'L', 90 => 'XC', 100 => 'C', 400 => 'CD', 500 => 'D', 900 => 'CM', 1000 => 'M' } result = '' number = self ...
true
d53e0c380fb41ff1e32a94112c0313e91a77ecb2
Ruby
dgrahn/baregrades
/app/models/access.rb
UTF-8
659
2.6875
3
[]
no_license
# File: access.rb # Class: Access # Type: Model # Author: Dan Grahn, Matt Brooker, Justin Engel # # Description: # This class is a utility model for maintaining connections # between different models. It tells us which users belong to # which courses and what roles they have. # ------------------------------------...
true
dab1efd13a89bc26fad5add75edd7418eb5eeb4d
Ruby
mathias/hackety-hack.com
/models/program.rb
UTF-8
750
2.640625
3
[]
no_license
# The `Program` class represents a program that someone's uploaded. Right now # we only store the latest version as text, but eventually, I'd love for # programs to be backed by `git`. class Program include MongoMapper::Document key :creator_username, String key :title, String key :slug, String # this is th...
true
cb0bb134d41274a9feef1b0739b61ad5bdefd7b2
Ruby
mahmoudazaid/rspec_practice
/spec/04_Matcher/05_error_exception_matcher_spec.rb
UTF-8
1,015
2.703125
3
[]
no_license
require 'spec_helper' require_relative '../unit/string_analyzer/string_analyzer' describe StringAnalyzer do before(:example) do @sa = StringAnalyzer.new end it "Error Matchers", :aggregate_failuresdo do expect { 1/0 }.to raise_error expect { 1/0 }.to raise_error(ZeroDivisionError) expect { 1/...
true
272994cfeaa0966d6ac3399ffc5448033a4197d5
Ruby
urnotjessie/regex-lab-v-000
/lib/regex_lab.rb
UTF-8
593
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def starts_with_a_vowel?(word) word.match(/\b[aeiouAEIOU]/) != nil end def words_starting_with_un_and_ending_with_ing(text) text.scan(/\bun\w*ing\b/) end def words_five_letters_long(text) text.scan(/\b\w{5}\b/) end def first_word_capitalized_and_ends_with_punctuation?(text) if text.match(/^[A-Z](.)*(...
true
ed9fab0d219cfa0a69c34ca2559a954bdd096638
Ruby
weilandia/battleship
/lib/battleship/players/computer.rb
UTF-8
2,691
3.203125
3
[]
no_license
class Battleship::Player::Computer < Battleship::Player attr_accessor :radar def take_turn puts "=============OPPONENT TURN=============" if radar coordinate = radar[:targets].pop cell = opponent.board.cells[coordinate] || valid_targets.sample else cell = valid_targets.sample end...
true
789a0f96056404f6b82244df69c5dc5b76de6b9c
Ruby
ralli/testman
/spec/models/testsuiterun_spec.rb
UTF-8
2,118
2.515625
3
[]
no_license
require 'spec_helper' describe Testsuiterun do describe "when validating" do def make_valid_testrun(attributes = {}) project = Project.new project.stub(Project.make.attributes) user = User.new user.stub(User.make(:current_project => project).attributes) testsuite = Testsuite.new ...
true
a8515d2c292dfdfe00bbead39f28e5153c1e4848
Ruby
sf-wdi-22-23/modules-23
/w10-mean/d4-drills-bst-traversal/rb/binary_tree.rb
UTF-8
360
3.40625
3
[]
no_license
## # This class represents a tree # with _exactly_ _two_ _subtrees_ # (one or both of which may be nil). class BinaryTree attr_accessor :key, :left, :right ## # Creates a new binary tree # with the root node key specified by key param # as the @key for the instance def initialize(key) @key = key ...
true
81db87f8479532ed9ca7ba94053445dbada8fc4b
Ruby
47colborne/cloud-sesame
/lib/cloud_sesame/query/ast/value.rb
UTF-8
972
2.71875
3
[ "MIT" ]
permissive
module CloudSesame module Query module AST class Value < Abstract::Value TYPES = { string: StringValue, numeric: NumericValue, datetime: DateValue } def self.map_type(symbol) (klass =TYPES[symbol]) ? klass : self end def self...
true