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
809b938ea7a323121a8234168bc29806eedbe047
Ruby
JuanSaieh/Koombea
/Ruby-exercises/palindromo.rb
UTF-8
1,794
3.9375
4
[]
no_license
# frozen_string_literal: true # A palindromic number reads the same both ways. The largest palindrome made from the product # of two 2 digit numbers is 9009 = 91 × 99. # Find the largest palindrome made from the product of two 3-digit numbers. # TODO # - 2 rangos de 100...999 # require 'minitest/autorun' start = Ti...
true
f92594be8f31dcc29ef86b53661498cb4e916e44
Ruby
ShaneTron/number_to_words
/lib/numbers_to_words.rb
UTF-8
1,465
3.71875
4
[]
no_license
class Integer def numbers_to_words() one_to_ten = Hash.new() one_to_ten.store(1,"one") one_to_ten.store(2,"two") one_to_ten.store(3,"three") one_to_ten.store(4,"four") one_to_ten.store(5,"five") one_to_ten.store(6,"six") one_to_ten.store(7,"seven") one_to_ten.sto...
true
2b0433ae96752f854c2b601afd0fae407a4a3158
Ruby
codeforamerica/vita-min
/spec/validators/alphanumeric_validator_spec.rb
UTF-8
917
2.546875
3
[ "MIT" ]
permissive
require "rails_helper" describe AlphanumericValidator do before do @validatable = Class.new do include ActiveModel::Validations validates_with AlphanumericValidator, attributes: :number attr_accessor :number end end subject { @validatable.new } context "not allowed characters: supe...
true
7cd480d07abae9372539ddb05db846173f61b6a9
Ruby
zeteticl/udonarium
/src/src_bcdice/diceBot/DemonParasite.rb
UTF-8
42,194
3
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # frozen_string_literal: true class DemonParasite < DiceBot # ゲヌムシステムの識別子 ID = 'DemonParasite' # ゲヌムシステム名 NAME = 'デモンパラサむト' # ゲヌムシステム名の読みがな SORT_KEY = 'おもんはらさいず' # ダむスボットの䜿い方 HELP_MESSAGE = <<INFO_MESSAGE_TEXT ・衝動衚 (URGEx)  "URGE衝動レベル"の圢で指定したす。  衝動衚に埓っお自動で骰子ロヌルを行い、結果を衚瀺したす。  ...
true
ea58cc3ec227423fa5d3064ad77a12e52b68d089
Ruby
joaonetoo/world-cup-api
/db/seeds.rb
UTF-8
2,436
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
663b7557b826ff9e5dfdd7825aeff2929fb3eb00
Ruby
gdiodati/metaheuristicas
/ldo_ido/sudoku_graph.rb
UTF-8
3,964
3.171875
3
[]
no_license
require 'matrix' class SudokuGraph attr_reader :size def initialize(size = 4) @limit = Math.sqrt(size).to_i fail "Size must be a square number" unless @limit**2 == size @size = size @matrix = Matrix.build(size) { |row, col| Node.new self, row, col } end def [](r,c) @matrix[r,c] end ...
true
3ed3ed2d79d010ff60144b1cf558975c67de5985
Ruby
bogusoft/cukehead
/examples/roundtrip.rb
UTF-8
1,922
3.046875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby class CukeheadRoundtripRunner def initialize @tmp = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp')) @bin = File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin')) end def usage puts <<xxx Usage: roundtrip.rb features_path Where: features_path = Pat...
true
656d145825a3c5fb86405e550aeb0eec3a6497f2
Ruby
greatscotty/Head_first_ruby
/chapter_10/include_enum.rb
UTF-8
411
3.890625
4
[]
no_license
class WordSplitter include Enumerable attr_accessor :string def each string.split(" ").each do |word| yield word end end end splitter = WordSplitter.new splitter.string = "How do you do" splitter.each do |word| puts word end p splitter.find_all {|word| word.include...
true
a6885cc6b7f6563fe03d682b5df1c9f72820a1f8
Ruby
bschwartz10/tic_tac_toe
/test/private/board_private_test.rb
UTF-8
727
2.59375
3
[]
no_license
require './test/test_helper' require './lib/board' class BoardPrivateTest < Minitest::Test attr_reader :board def setup @board = Board.new end def test_spot_is_available_returns_true_when_spot_is_available assert_equal true, board.send(:spot_available?, '0') end def test_spot_is_available_return...
true
16f14c9300c0518354c117a29ec83cdce7645da5
Ruby
Muriel-Salvan/riffola
/spec/riffola_spec.rb
UTF-8
16,320
3.140625
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
require 'riffola' require 'tempfile' require 'hex_string' describe Riffola do # Are we in debug mode? # # Result:: # * Boolean: Are we in debug mode? def debug? ENV['TEST_DEBUG'] == '1' end HEX_DUMP_CHARS_SIZE = 16 # Convert a given string in a debuggable hexadecimal format # ...
true
ad92bbbb3add194dfac7d10152fd6685eb871694
Ruby
ajasja/Rgle
/lib/examples/3_color_map/color_map.rb
UTF-8
1,192
2.6875
3
[]
no_license
require 'rgle' include RGle #change working directory to current dir Dir.chdir(File.dirname(__FILE__)) def create_xyz_file(dest_name) datax =[] datay =[] dataz =[] i = 0; Dir['data/*'].each do |file_name| File.open(file_name, "r") do |file| #skip first line file.gets y_val = /(\d\d)$/.ma...
true
2409c97c05f6392a12f4c985b966f4b8f957f17f
Ruby
gnilrets/Remi
/spec_old/interfaces/canonical_interface_spec.rb
UTF-8
2,120
2.578125
3
[ "MIT" ]
permissive
require 'remi_spec' describe Interfaces::CanonicalInterface do # Reset the work directory before each test before { RemiConfig.work_dirname = Dir.mktmpdir("Remi-work-", Dir.tmpdir) } let(:mylib) { Datalibs::CanonicalDatalib.new(RemiConfig.work_dirname) } let(:interface) { Interfaces::CanonicalInterface.new(m...
true
a5441385ada69b739c9e2e8aaf0e9c4226039c53
Ruby
gveve/anagram-detector-web-100817
/lib/anagram.rb
UTF-8
205
3.40625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Anagram attr_accessor :word def initialize(word) @word = word end def match(array) array.delete_if do |x| x.chars.sort != @word.chars.sort end end end
true
3642589d345faf548a68945faca00b24d3278d59
Ruby
garrmark/mohawk
/lib/mohawk/accessors/table_row.rb
UTF-8
1,314
2.546875
3
[ "MIT" ]
permissive
module Mohawk module Accessors class TableRow include RAutomation::Adapter::MsUia attr_reader :row def initialize(table, row_index) @table = table @row = Row.new(@table.view, :index => row_index) end def selected? row.selected? end ...
true
0fc462b4da51f064098d1354bb80375e6e6de33d
Ruby
dougjohnson/holiday_machine
/app/models/vacation.rb
UTF-8
5,210
2.703125
3
[ "MIT" ]
permissive
class Vacation < ActiveRecord::Base belongs_to :holiday_status belongs_to :holiday_year belongs_to :user before_save :save_working_days before_destroy :check_if_holiday_has_passed after_destroy :add_days_remaining after_create :decrease_days_remaining scope :team_holidays, lambda { |manager_id| wher...
true
3fbc07a0ebff38efab74df017eb3bb84cb983a09
Ruby
roomorama/concierge
/lib/concierge/suppliers/avantio/commands/quote_fetcher.rb
UTF-8
2,752
2.875
3
[]
no_license
module Avantio module Commands # +Avantio::Commands::QuoteFetcher+ # # This class is responsible for wrapping the logic related to making a price # quotation to Avantio, parsing the response. # # NOTE: Avantio GetBookingPrice method returns valid response even # if accommodation is ...
true
18a3dff89e12f1c73938bc8262f3c484f2908dff
Ruby
ssiarules/collections_practice-online-web-pt-011419
/collections_practice.rb
UTF-8
847
3.96875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#1 def sort_array_asc (num) num.sort end #2 def sort_array_desc (num) num.sort do |a, b| b <=> a end end #3 def sort_array_char_count(num) num.sort do |a, b| a.length <=> b.length end end #4 def swap_elements(num) num[1], num[2] = num[2], num[1] num end #Advanced def swap_elements_fro...
true
6c80066ee72e39b49e4cac172fc14447fb515608
Ruby
DorianCBrwn/LaunchSchoolDCB
/RB101/small_problems/Easy_3/arithmetic_int.rb
UTF-8
958
4.28125
4
[]
no_license
=begin Write a program that prompts the user for two positive integers, and then prints the results of the following operations on those two numbers: addition, subtraction, product, quotient, remainder, and power. Do not worry about validating the input. =end def prompt(message) puts "==> #{message}" end prompt( "En...
true
955ffc7b8da47ed8c77b206a1875319777e3c598
Ruby
lbrian357/bubble_sort
/spec/bubble_sort_spec.rb
UTF-8
560
3.546875
4
[]
no_license
require 'bubble_sort' describe '#bubble_sort' do it 'takes an array and returns a sorted array' do expect(bubble_sort([4,3,78,2,0,2])).to eq([0,2,2,3,4,78]) end end describe '#bubble_sort_by' do it 'sorts an array of numbers based on a block' do expect(bubble_sort_by([2,5,4,3,2,1]){|left,right| left - r...
true
3e50cbab2f2236dc8ae2b55516b4ce375cca6751
Ruby
Lastimoso/sorting
/sorting_benchmarks.rb
UTF-8
2,903
3.40625
3
[]
no_license
# frozen_string_literal: true require 'benchmark' require './bubble' require './selection' require './insertion' require './merge' def sorted?(array) array.each_cons(2).all? { |a, b| (a <=> b) <= 0 } end def array_is_ok?(array) array.each_with_index do |value, index| return false unless value == index + 1 ...
true
e24a2714b80e81fbb5bc925fccb5f8da6566ebd9
Ruby
shahpriyesh2005/CAD_Project
/app/models/wishlist.rb
UTF-8
535
2.5625
3
[]
no_license
class Wishlist < ApplicationRecord belongs_to :user EVENT_NAME = [] @events = Event.distinct.pluck(:title) @events.each do |names| EVENT_NAME << names end validates :wishlist_date,:user_id,:event_id, :presence => true validate :check_wishlist_date private def check_wishlist_dat...
true
b5d530475bbfb475bf7ae1254f9dcae89deeeb6b
Ruby
martom87/ror_and_ruby_exercises
/ruby_excercises/algorithms/sorting/sorter.rb
UTF-8
1,240
3.8125
4
[]
no_license
class Sorter def bubble_sort (input) swap = true return input if input.size <= 1 while swap swap = false ((input.size) - 1).times do |i| if input[i] > input[i + 1] swap = true input[i], input[i + 1] = input[i + 1], input[i] end end end return ...
true
292e5575b3e660e61ee2a5089c39a207a2fca8ac
Ruby
brandnewbox/gush-control
/lib/gush/control/logger.rb
UTF-8
1,817
2.734375
3
[ "MIT" ]
permissive
require 'logger' require 'time' module Gush module Control class Logger include ::Logger::Severity attr_accessor :level, :progname def initialize(redis, channel, level = DEBUG) @progname = nil @redis = redis @level = level @channel = channel end de...
true
3092c6f0ee25bb493e7965d1a1943751cf158ce9
Ruby
andrefaria/where-to-go
/app/models/event.rb
UTF-8
521
2.8125
3
[]
no_license
class Event < ActiveRecord::Base has_many :options validates_presence_of :date def pick_a_place if self.options.empty? or self.options.length <= 1 then self.errors.add :place, 'To pick a place you should first add at least two options to the event' return false else old_place = se...
true
f7130eba4ced2ca25b5f0b7c47fd1240b9385492
Ruby
iagomoure/important-programs
/chess_validator/chess_validator.rb
UTF-8
1,085
3.25
3
[]
no_license
require 'pry' class Rock end class Knight end class Bishop end class Queen end class King end class Pawn end class Board def initialize @grid = [ [:bR,:bN,:bB,:bQ,:bK,:bB,:bN,:bR], [:bP,:bP,:bP,:bP,:bP,:bP,:bP,:bP], [nil,nil,nil,nil,nil,nil,nil,nil], [nil,nil,nil,nil,nil,nil,nil,nil], [nil,nil...
true
74c79f5a3cba68adc1d46e2e9025e8406d725fe7
Ruby
ztaylorpossible/DailyProg
/Ruby/30e.rb
UTF-8
863
4.375
4
[]
no_license
# Daily Programmer Easy Challenge #30 July 8, 2013 # Summary: # Write a program that takes a list of integers and a target number and # determines if any two integers in the list sum to the target number. If # so, return the two numbers. If not, return an indication that no such # integers exist. puts "Enter a list of...
true
299833ec14e5e852d8b8320ed67e34acf9594380
Ruby
rakibulislam/BDDPackage
/table_h.rb
UTF-8
385
3.15625
3
[]
no_license
class Table_H attr_accessor :h def initialize @h = Hash.new end def member?(triple) key = build_key(triple) h.keys.include? key end def lookup(triple) key = build_key(triple) h[key] end def insert(triple, u) key = build_key(triple) h[key] = u end def build_key(triple...
true
d5f0e5ab4cec19588de0a62dd0d1a02eeeaaed2a
Ruby
r7kamura/rnes
/lib/rnes/dma_controller.rb
UTF-8
745
2.703125
3
[ "MIT" ]
permissive
module Rnes class DmaController TRANSFER_BYTESIZE = 2**8 # @param [Rnes::Ppu] ppu # @param [Rnes::Ram] working_ram def initialize(ppu:, working_ram:) @ppu = ppu @requested = false @working_ram = working_ram end def transfer_if_requested if @requested transfer ...
true
017cab8d49520e1d223073fafaac962aec92c40f
Ruby
BrownCow371/rack-intro-v-000
/application.rb
UTF-8
193
2.53125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Application def call(env) resp = Rack::Response.new resp.write "Hello, World \n" resp.write "Hello, my name is Simon and I like to do drawings!" resp.finish end end
true
36f191b472e7266fbb9007052278622b57765c75
Ruby
anumolusrikanth/training
/srikanth/ruby_prgms/first.rb
UTF-8
679
3.875
4
[]
no_license
#!/usr/bin/env ruby $global_var=3 Const ='welcome' class Print @@no_of_persons=0 def first_method puts "Hello : #$global_var" ::Const + 'Macys' end def initialize(id, firstname) @person_id=id @person_name=firstname end def display puts "Person ID is #@person_id" puts "Person Name is ...
true
ff76a87a00dc06877f0b0876fe3be7989aae2b2e
Ruby
byroot/parsr
/lib/parsr/rules/hash.rb
UTF-8
1,206
2.84375
3
[ "MIT" ]
permissive
module Parsr::Rules::Hash class MissingValue < Parsr::SyntaxError message "unexpected '%{rest}'" end class MissingSeparator < Parsr::SyntaxError message "unexpected '%{rest}', expecting '=>'" end class Unterminated < Parsr::SyntaxError message "unexpected '%{rest}', expecting '}'" end clas...
true
f33c46fe95524c556438d62b35121bcd3fbd4ee7
Ruby
Dpalazzari/module_3_assessment
/app/site_models/store_total.rb
UTF-8
186
2.71875
3
[]
no_license
class StoreTotal attr_reader :count def initialize(total={}) @count = total end def self.find_total(zip) total = StoreService.find_total(zip) new(total) end end
true
58df1bca7169f78b28da51a6b0997c806990d98b
Ruby
intrip/ruby-algorithms
/geeks_for_geeks/bottom_view_binary_tree.rb
UTF-8
3,825
3.953125
4
[]
no_license
# https://practice.geeksforgeeks.org/problems/bottom-view-of-binary-tree/1 # Given a binary tree, print the bottom view from left to right. # A node is included in bottom view if it can be seen when we look at the tree from bottom. # 20 # / \ # 8 22 ...
true
ebb0f8ec705233ac36fc7e275d2eae5cecd12d15
Ruby
isatakebayashi/stock-management
/app/services/stock_management_service.rb
UTF-8
535
2.953125
3
[]
no_license
class StockManagementService attr_accessor :amount, :stock def initialize(id, amount) @stock = find_stock(id) @amount = amount.to_i end def update_stock(operation) new_amount = send(operation) @stock.update!(amount: new_amount) rescue ActiveRecord::RecordInvalid => e { error: 'Quantida...
true
10af836fcf8684f10b59f0a47a0fb0ab9622c17a
Ruby
Rxbsxn/factorialize_recursion
/factorialize_by_recursion_spec.rb
UTF-8
774
2.921875
3
[]
no_license
require "./factorialize_by_recursion" describe Factorialize do describe ".factorialize" do context "Given -4" do it "should return -1" do expect(Factorialize.factorialize(-3)).to eql(-1) end end context "Given 0" do it 'should return 1' do...
true
16d8bc8cc74909d3dac6114645d223b413083fd2
Ruby
bellmyer/genetic-algorithm
/lib/hello_world.rb
UTF-8
597
3.4375
3
[]
no_license
class HelloWorld attr_reader :target, :letters LETTER_POOL = ( ('a'..'z').to_a + ('A'..'Z').to_a + '!?.,-_ '.split('') ) TARGET = "Hello, World!" class << self def top_score return @top_score if defined?(@top_score) @top_score = TARGET.size end end def initializ...
true
df7835cd10f0d7f3b624f218ba53e79ec7ebc68f
Ruby
isabella232/twitter-search-sample
/lib/twitter_search.rb
UTF-8
2,364
2.609375
3
[ "Apache-2.0" ]
permissive
require 'tweetstream' require 'twitter' require 'nokogiri' require 'uuidtools' require 'httpclient' class TwitterSearch attr_reader :hash_tags def initialize(params = {}) @hash_tags = params[:hash_tags] authenticate_twitter end def authenticate_twitter Twitter.configure do |config| config...
true
cd146d0ed57b4cc0451986e7788f3cba7aaafee2
Ruby
tijn/reactive_array
/lib/serializing_array.rb
UTF-8
860
2.796875
3
[]
no_license
# calls #rewrite! upon any method that is not used for reading class SerializingArray < ReactiveArray # these methods are only used for reading, not for writing so we don't have to #rewrite! when they are used. SAFE_METHODS = [:[], :abbrev, :assoc, :at, :collect, :compact, :empty?, :eql?, :first, :flatten, :frozen,...
true
505821cd136d66b9a93f002f8375d6766f050d79
Ruby
YogiZoli/studiogame-2015
/lib/studio_game/game.rb
UTF-8
3,534
3.40625
3
[]
no_license
#require "player" #require 'pry' #pry.binding require 'studio_game/player' require 'studio_game/die' require 'studio_game/game_turn' require 'studio_game/treasure_trove' module StudioGame class Game attr_reader :title def initialize(title) @title = title @players = ...
true
716fc9f16dfdda00236f757f29267de0a5860bb0
Ruby
manavt/E-commerce
/lib/mygem.rb
UTF-8
181
2.6875
3
[]
no_license
class Mygem class << self def calc(op, *args) array = *args return array if array.count == 1 result = array.inject(op) return result end end end
true
dbc0d22ae8c534a74baf1786b19f3080526cc36f
Ruby
rsmith167/cartoon-collections-onl01-seng-pt-030220
/cartoon_collections.rb
UTF-8
743
3.609375
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(array)# code an argument here # Your code here array.each_with_index do |name, index| puts "#{index+1} #{name}" end end def summon_captain_planet(array)# code an argument here # Your code here array.collect do |call| call = call.capitalize call << "!" end end def long_p...
true
d4db2412d8d0ca0f2b6f82d7a7ebd8bcec53ed4f
Ruby
jbharwood/code-challenges
/sumzero/temperature.rb
UTF-8
1,303
3.4375
3
[]
no_license
require 'pry' class TemperatureTracker def initialize @temperatures = [] end def insert(temp) @temperatures << temp end def getMax @temperatures.max end def getMin @temperatures.min end def getMean sum = 0 @temperatures.each do |t| sum += t end mean = sum/@t...
true
1454292db150a52a5afb3444c11ca811417af392
Ruby
ArjunAranetaCodes/MoreCodes-Ruby
/Conversions/problem5.rb
UTF-8
133
3.53125
4
[]
no_license
#Problem 5: Write a program that converts an array/list to string. arrNumbers = [1,2,3] numbers = arrNumbers.join("") print numbers
true
3fb1af8343372618ec473692dd135b2ff4afc483
Ruby
SebCodesStuff/ar-exercises
/exercises/exercise_5.rb
UTF-8
438
3.03125
3
[]
no_license
require_relative '../setup' require_relative './exercise_1' require_relative './exercise_2' require_relative './exercise_3' require_relative './exercise_4' puts "Exercise 5" puts "----------" @totalRevenue = Store.sum(:annual_revenue) puts "Total revenue is $#{@totalRevenue}" count = Store.count(:annual_revenue) put...
true
f35e9bd09db177b14fe2d3f05a027f72b2762f8d
Ruby
smodiz/quiznerd
/app/models/flash_card_importer.rb
UTF-8
1,629
3.109375
3
[]
no_license
# This class is for creating a flash # card deck from a quiz. The questions # on the quiz become flash cards on the # deck. This is only currently used from # the console and not from the web interface # of the application. class FlashCardImporter attr_reader :deck delegate :errors, to: :deck def initialize(dec...
true
a94f50884bf1c42beeb1172b71983db177ac313f
Ruby
Sh1pley/enigma
/lib/encrypt.rb
UTF-8
730
3.234375
3
[]
no_license
require_relative 'file_worker' require_relative 'encryption' require_relative "encryption_rotations" class Encrypt # binding.pry attr_reader :file_worker, :encryption def initialize @file_worker = FileWorker.new end def open_file message = file_worker.file_reader(ARGV[0]) encrypt...
true
984fb0d3ab65298bcbc7993189e94de25d8f2533
Ruby
kinasmith/kinasmith.com
/_plugins/vimeo.rb
UTF-8
713
2.515625
3
[ "Apache-2.0" ]
permissive
# A plugin for embedding videos from Vimeo using a simple Liquid tag, ie: {% vimeo 12345678 %}. # Based of the Youtube plugin from https://www.portwaypoint.co.uk/jekyll-youtube-liquid-template-tag-gist/ # bug. Videos don't scale module Jekyll class Vimeo < Liquid::Tag @@width = 690 @@height = 471 def i...
true
f0dbcfc268d28aab840d762bc0028ef6e9fc8bd6
Ruby
lefarmer/uk_mail
/lib/uk_mail/ireland_data.rb
UTF-8
1,189
2.6875
3
[ "MIT" ]
permissive
module UKMail class IrelandData IRELAND_COUNTY_PREFIXES = %w[County Cnty CC. CC Ct. Ct Co. Co C.] IRELAND_COUNTIES = %w[ Carlow Cavan Clare Cork Donegal Dublin Galway Kerry Kildare Kilkenny Laois Leitrim Limerick Longford Louth Mayo Meath Monaghan Offaly Roscommon Sligo Tipperary Waterford W...
true
682d9734780cfeb10bc767d073ba94b42e2d8316
Ruby
dancarter/FlashTerminal
/menuselector.rb
UTF-8
2,072
3.578125
4
[]
no_license
class MenuSelector attr_reader :decks OPTIONS = ['done','delete','new','edit'] def initialize(decks) @decks = decks.nil? ? {} : decks @reviewing = true end def menu puts "Decks--------------------------------" @decks.each_key do |name| puts "#{name}" end puts "No decks made yet...
true
a1561b522ba032d94994e88b3cd8bb20529dbdaf
Ruby
envylabs/Gister
/spec/middleware_spec.rb
UTF-8
2,870
2.578125
3
[ "MIT" ]
permissive
require 'gister/middleware' require_relative 'helper' require 'rack' describe Gister::Middleware do let(:app) { load_app } let(:response) { request(app, path) } subject { response } describe "when responding to a request with a gist path" do context "and the path has a github username in it" do le...
true
c55b1868cd281af536500599d8bd0650ec6b0b2d
Ruby
benrodenhaeuser/exercises
/small_problems/04_Easy_04/10_integer_to_string.rb
UTF-8
479
3.796875
4
[]
no_license
def to_string(positive_integer) number = positive_integer str_array = [] loop do str_array.unshift(number % 10) number /= 10 break if number == 0 end str_array.join end def signed_integer_to_string(integer) if integer > 0 '+' + to_string(integer) elsif integer < 0 '-' + to_string(inte...
true
f7b57043f13e6da49cbce85b8ae720fcc9f4aac0
Ruby
ignacy/invaders
/lib/invaders/potential_match.rb
UTF-8
1,710
3.078125
3
[]
no_license
require 'forwardable' module Invaders class PotentialMatch THRESHOLD = 0.8 extend Forwardable def_delegators :@lower_right_point, :x, :y def_delegators :@invader, :width, :height def initialize(radar_reading:, invader:, lower_right_point:, match_strategy: MatchStrategies::Lexical, threshold: THR...
true
93cc6a596645c516aabfce12885a9f56ab36e5b7
Ruby
lucatironi/aoc2017
/day15.rb
UTF-8
2,225
3.28125
3
[]
no_license
require "minitest/autorun" CONSTANT = 2147483647 class Generator attr_reader :value, :factor, :div def initialize(value, factor, div = 1) @value = value @factor = factor @div = div end def next_value loop do @value = (@value * @factor) % CONSTANT break if @value % @div < 1 en...
true
3f1f433aff7ca78b2c758649062d5dca158be609
Ruby
Rahul-Krishnan/challenges
/fizz-buzz/lib/fizz_buzz.rb
UTF-8
178
3.671875
4
[]
no_license
# YOUR CODE HERE (1..100).each do |n| if n%3 == 0 && n%5 == 0 puts "Fizzbuzz" elsif n%3 == 0 puts "Fizz" elsif n%5 == 0 puts "Buzz" else puts n end end
true
32a3030b51d671ec2b7e0ba89a20faae0c9fd99d
Ruby
tekpub/rack
/model/haiku.rb
UTF-8
929
2.90625
3
[]
no_license
class Haiku def initialize @poems = [ "An old silent pond... A frog jumps into the pond, splash! Silence again.", "Sick and feverish Glimpse of cherry blossoms Still shivering", "Without flowing wine How to enjoy lovely Cherry blossoms", "The first so...
true
47f5814c67b09bd6fc3133eab924a3b2c650e1dc
Ruby
petekinnecom/check_up
/integration_test.rb
UTF-8
2,187
2.5625
3
[]
no_license
require "minitest/autorun" require "open3" require "securerandom" class IntegrationTest < Minitest::Test def setup raise "Compile the binary first" unless File.exist?("./_build/check_up_test") end def test_integration__success Tempfile.open do |file| file.puts <<~YAML services: ...
true
a298a17ca10bccef7fe58b906eb70265603fe481
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/d16fdc044a0e4428812eac8fa34452c6.rb
UTF-8
477
3.59375
4
[]
no_license
require 'active_support' class Bob def hey message return "Fine. Be that way!" if empty?(message) return "Woah, chill out!" if yell?(message) return "Sure." if question?(message) "Whatever." end private def empty? message message.gsub(/\s/, '').empty? end def yell? message meani...
true
5eaef8dbd1ad96432384b6572e639ce4669ff586
Ruby
alexshev91/ruby_challenges_lab
/calculator.rb
UTF-8
1,326
4.8125
5
[]
no_license
# # ### Challenge 2 - Calculator # # Create a simple calculator that first asks the user what method they would like to use (addition, subtraction, multiplication, division) # and then asks the user for two numbers, returning the result of the method with the two numbers. Here is a sample prompt: # # ``` # # What ca...
true
b52c40a429e064b34d0d0c55de78b547b4673669
Ruby
rapid7/ruby_smb
/examples/enum_registry_values.rb
UTF-8
1,089
2.625
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Ruby" ]
permissive
#!/usr/bin/ruby # This example script is used for testing values enumeration of a specific Winreg registry. # It will attempt to connect to a host and enumerate values of a specified registry key. # Example usage: ruby enum_registry_values.rb 192.168.172.138 msfadmin msfadmin HKLM\\My\\Key # This will try to connect t...
true
847b032d02faf2d8836678f41b48f12c7e986c13
Ruby
SleepingInsomniac/minecraft-scripts
/ChangeLog.rb
UTF-8
1,523
2.921875
3
[]
no_license
#!/usr/bin/env ruby require 'yaml' # =================================================== # = Track the changes made to a directory structure = # =================================================== # Written by Alex Clink, 2014-07-10 class ChangeLog def initialize(directory) @directory = File.expand_path dir...
true
7e060c72c10791318753337664c495c33f5dbc42
Ruby
Yuni-Q/blog
/TIL/Ruby/Ruby_opentutorials/Logical/logical_operation1.rb
UTF-8
352
3.640625
4
[ "MIT" ]
permissive
#if 쀑첩 puts("아읎디륌 입력핎죌섞요") input_id = gets.chomp() puts("비밀번혞륌 입력핎죌섞요") input_pwd = gets.chomp() real_id = "egoing" real_pwd = "11" if real_id == input_id if real_pwd == input_pwd puts("Hello!") else puts("잘못된 비밀번혞입니닀") end else puts("잘못된 아읎디입니닀") end
true
b75b43eb59056747b497b7384e0e97213cdcd121
Ruby
radiohead/knn
/lib/knn/knn.rb
UTF-8
886
3.515625
4
[ "MIT" ]
permissive
module KNN class KNN attr_reader :data, :unknown_index, :distance def initialize(data, unknown_index, distance = :euclidean) fail 'Only euclidean distance is currently implemented!' if distance != :euclidean @data = data @distance = distance @unknown_index = unknown_index end ...
true
96da5c6a22aa9d3d376e00d711f7b2b445bc4be4
Ruby
Rdrandle/ttt-3-display_board-example-q-000
/lib/display_board.rb
UTF-8
281
3.515625
4
[]
no_license
# Define a method display_board that prints a 3x3 Tic Tac Toe Board board =[" "," "," "," "," "," "," "," "," "] def display_board(name) puts" | | ----------- | | ----------- | | #{name[x]}" end display_board(board)
true
160fafd9e194c62f98c87e40232731e8802c8cec
Ruby
DigitalKnight0/recursion
/merge-sort.rb
UTF-8
578
3.59375
4
[]
no_license
def merge_sort(arr) return arr if arr.length < 2 mid = arr.length/2 merge(merge_sort(arr[0..(mid-1)]),merge_sort(arr[mid..arr.length])) end def merge(left,right) sorted = [] count = 0 until (left.empty? && right.empty?) if left.empty? sorted << right.shift elsif right.e...
true
709690e78f050cc3d7a37fb2fdca95c1c32b523b
Ruby
JisuKim82/cake
/spec/2-flatten_method_spec.rb
UTF-8
347
3.078125
3
[]
no_license
require_relative 'spec_helper' require_relative '../2-flatten_method' describe 'Flatten Method' do it 'returns itself if array passed in is a single dimensional array' do expect(flatten_method([1,2,3])).to eq [1,2,3] end it 'returns [1,2,3] when [1,[2,3]] is passed in' do expect(flatten_method([1,[2,3]...
true
7e9f0e5addcb1a18d421549e939477e3d7ee73be
Ruby
AgileTrossDev/job_manager
/lib/jm/job.rb
UTF-8
3,143
3.203125
3
[]
no_license
# Job - Executes an action and optional post-processing/exception handling. It's intended purpose is to be executed by a thread manager. # The creator of jobs should be conservative when deciding the time-out period for the job. A post processing/error handling # call-back can be defined. This counts ag...
true
779ce44642bd7fada211d3f981bf7f754eaeac70
Ruby
vizjerai/google-checkout
/examples/google_notifications_controller.rb
UTF-8
4,983
2.671875
3
[ "MIT" ]
permissive
## # Skeleton for handing Level 2 notifications from GoogleCheckout with Rails. # # You'll need to write the individual handlers. SSL is required. # # SAMPLE ONLY! Modify for your own use. Extra error handling may be needed. class GoogleNotificationsController < ApplicationController before_filter :verify_access ...
true
9f1fd20ce27d4831b483d0f95bc9f2e3b4523bbc
Ruby
KaiKaspar/intro-to-simple-array-manipulations-london-web-career-021819
/lib/intro_to_simple_array_manipulations.rb
UTF-8
1,681
3.75
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def using_push(countries_in_western_africa, element) # ads element to back of array countries_in_western_africa.push("Niger") end def using_unshift(neighborhoods_in_northwest_brooklyn, element) # ads element to front of array neighborhoods_in_northwest_brooklyn.unshift("Brooklyn Heights") end def usin...
true
afbe9492f903f9f634f797387a0a72b76260fd85
Ruby
Aurabelle/boost-challenge
/atbash.rb
UTF-8
891
3.609375
4
[]
no_license
class Atbash CIPHER = 'oephjizkxdawubnytvfglqsrcm' ENCRYPTED_TEXT = 'knlfgnb, sj koqj o yvnewju' def initialize Decryptor.new(cipher: CIPHER, encrypted_text: ENCRYPTED_TEXT ).run_decryption end end class Decryptor ALPHABET_CONSTANT = 'abcdefghijklmnopqrstuvwxyz' attr_reader :original_text...
true
0f922d33bd11be76aee9918c5794043acb543e31
Ruby
nathanworden/RB101-Programming-Foundations
/RB101-RB109_small_problems/01.easy_1/08.array_average.rb
UTF-8
2,456
5
5
[]
no_license
# Understand the Problem # Write a method with one argument # input: an array containing integers # output: the average of all numbers in the array # The array will never be empty and the numbers will always be positive integers # Examples / Test Cases: # puts average([47, 78, 9876, 2, 3, 5, 7]) == 1431 # puts avera...
true
694d23d8106c6927ac7d66b56bba78abd3c40fed
Ruby
athio92/launchschool
/courses/100/L1T13/09_More_Stuff/exercise1.rb
UTF-8
186
2.75
3
[]
no_license
def contains?(str) /lab/.match(str) ? (puts str) : (puts "Not found") end ["laboratory", "experiment", "Pans Labyrinth", "elaborate", "polar bear"].each do |str| contains?(str) end
true
990982e3829cba2bd4aaa7c3d845f3e2bf76642f
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/robot-name/41c5fd9c919648479e910da85b1ffa4e.rb
UTF-8
781
3.46875
3
[]
no_license
require 'set' class Robot def name @name ||= UniqueNameGenerator.generate end def reset @name = nil end end class UniqueNameGenerator DIGITS = ('0'..'9').to_a LETTERS = ("A".."Z").to_a def self.generate name = generate_name name = generate_name while generated?(name) add(name) && ...
true
a80585cae275b3d46e44f874a9c706b484c9e3b2
Ruby
SeanWelshBrown/ruby-oo-relationships-practice-art-gallery-exercise-dumbo-web-120919
/app/models/painting.rb
UTF-8
513
3.359375
3
[]
no_license
class Painting attr_reader :artist, :title attr_accessor :price, :gallery @@all = [] # INITIALIZATION # def initialize(artist, title, price, gallery) # WORKS # @artist = artist @title = title @price = price @gallery = gallery @@all << self end # CLASS METHODS # def self.all # ...
true
676fd3f5526b85e507b7df3baaeadf79ae92090c
Ruby
cbeer/solr_wrapper
/lib/solr_wrapper/downloader.rb
UTF-8
888
2.671875
3
[ "MIT" ]
permissive
require 'ruby-progressbar' require 'http' module SolrWrapper class Downloader def self.fetch_with_progressbar(url, output) pbar = SafeProgressBar.new(title: File.basename(url), total: nil, format: '%t: |%B| %p%% (%e )') response = HTTP.follow.get(url) pbar.total = response.headers['content-len...
true
7f82c8e24e591c4851ffd69f2bbe1f80842c276e
Ruby
tobymao/mistery
/app/views/plays/result.rb
UTF-8
759
2.515625
3
[]
no_license
class Views::Plays::Result < Views::Layouts::Page needs :play def main h1 "Finished Game" div 'Solution:' do text simple_format play.scenario.solution, class: 'mainText' end div "Score #{play.points}" guesses = Guess .includes({question: {answers: [:location, :suspect]}}, :answer...
true
678fbec60d4fe97793fd6890be5f277ef0697a09
Ruby
yoshixmk/yomi
/md5-verifier/main.rb
UTF-8
261
2.53125
3
[]
no_license
require "./zpai" require "./dpai" require "./npai" require "./pg" all_pai = npai() + zpai() + dpai() conn = open() i = 0 while(1) do shuffled = 100000.times.map{|i| all_pai.shuffle.take(83).join()} insert(shuffled, conn) i += 1 p i end close(conn)
true
0f3a2cbdd940f9e7c4caaaa4e2d4ba185bb26256
Ruby
karask/bitstampbot
/bot.rb
UTF-8
3,063
2.890625
3
[]
no_license
require "bitstamp" require "logger" logfile = "logbot.log" #logfile = Time.now.strftime("log-%Y%m%d-%H%M%S") + ".log" File.delete(logfile) if File.exist?(logfile) $LOG = Logger.new(logfile); Bitstamp.setup do |config| config.key = ENV['BITSTAMP_KEY'] config.secret = ENV['BITSTAMP_SECRET'] config.client_id = E...
true
1b542d7a9af31296e9ef78b830a9aacadd49d203
Ruby
KevinMcHugh/mustached-nemesis
/app/models/events/hit.rb
UTF-8
823
3.0625
3
[]
no_license
module Hit def hit!(hitter=nil) @health -= 1 Event.new(event_listener, self, hitter) if dead? beer if dead? #The beer *may* have brought you back to life. PlayerKilledEvent.new(event_listener, self, hitter) raise PlayerKilledException.new end end end class Event ...
true
df1b4f30bb92cbe697e9635647d534c7756703ff
Ruby
jewel/clone-terminal-window
/clone-terminal-window
UTF-8
837
2.5625
3
[]
no_license
#!/usr/bin/ruby # Clone a gnome-terminal window. This will attempt to connect to the same # directory, connect to the same remote host, and run sudo if necessary. require 'shellwords' def se arg Shellwords.shellescape arg end title = `xdotool getactivewindow getwindowname`.chomp title = ARGV.first if ARGV.first ...
true
11a5032d7d4f5689b3b010405a6354abd933b295
Ruby
Rmole57/launch-school
/rb130/rb130-ruby_foundations_exercises/easy1/encrypted_pioneers.rb
UTF-8
5,765
3.796875
4
[]
no_license
ENCRYPTED_PIONEERS = [ "Nqn Ybirynpr", "Tenpr Ubccre", "Nqryr Tbyqfgvar", "Nyna Ghevat", "Puneyrf Onoontr", "Noqhyynu Zhunzznq ova Zhfn ny-Xujnevmzv", "Wbua Ngnanfbss", "Ybvf Unvog", "Pynhqr Funaaba", "Fgrir Wbof", "Ovyy Tngrf", "Gvz Orearef-Yrr", "Fgrir Jbmavnx", "Xbaenq Mhfr", "Fve Nagba...
true
ae1ff7b5831dfb044ac959909649ac10bb068034
Ruby
joseantoniopb/tuenti-Challenge-2012-Solutions
/erpheus (13, Ruby)/decimo.rb
UTF-8
1,824
3.90625
4
[]
no_license
class StrangeLanguage #0,3 and 4 aren't actual numbers of arguments, but this was an easy implementation for each functions particularities NUM_ARGUMENTS = Hash["."=>0,"mirror"=>1,"breadandfish"=>4,"#"=>2,"fire"=>2,"$"=>2,"dance"=>3,"conquer"=>2,"&"=>2,"@"=>2] METHOD_CALL = Hash["mirror"=>:inverse,"breadan...
true
b72fb011c95d6cc4331446445e6ddfe5fc800885
Ruby
kendraash/recipe_box
/spec/recipe_spec.rb
UTF-8
475
2.59375
3
[ "MIT" ]
permissive
require('spec_helper') describe(Recipe) do it('changes the rating into an integer') do new_recipe = Recipe.create({name: 'chicken stir fry suprise', rating: '3'}) expect(new_recipe.rating).to(eq(3)) end describe('#dishes') do it('returns a recipe') do new_recipe = Recipe.create({name: 'chicke...
true
7483465c5e06468a1f8dd8c9e6022ba91c98bf00
Ruby
JunePaloma/open_mic
/lib/joke.rb
UTF-8
401
3.0625
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/joke' require './lib/user' require "pry" class Joke attr_reader :jokes def initialize @jokes = {id: 1, question: "Why did the strawberry cross the road?", answer: "Because his mother was in a jam."} end def id @jokes[:id] end def q...
true
b07aa51b30b630587d1c81e382bfbfd8002c2ae5
Ruby
noahschultz/dealesque
/app/services/amazon_search_response_parser.rb
UTF-8
2,708
2.5625
3
[]
no_license
require 'nokogiri' class AmazonSearchResponseParser include AmazonParser def parse(response) root = Nokogiri::XML(response.body).remove_namespaces! attributes = {} attributes[:search_terms] = parse_search_terms(root) attributes[:items] = parse_items(root) SearchResult.new(attributes) end ...
true
cd0d45e0810f70c870e7726267327a5cb2fec6e8
Ruby
teashton/learning_ruby_oop
/redo_brain_teaser.rb
UTF-8
222
3.484375
3
[]
no_license
@array = [] def add_element puts 'please input a numer to add to the array' element = gets.strip puts 'added to array' @array << element puts 'numbers in your array' puts @array add_element end add_element
true
389eef0ec8addfd8b5db330c77eca7484cb7925e
Ruby
ongaeshi/9ccr
/tokenize.rb
UTF-8
2,526
3.75
4
[]
no_license
# # tokenize.rb # TK_RESERVED = 0 TK_NUM = 1 TK_EOF = 2 # Token type Token = Struct.new( :kind, # Token kind :next, # Next token :val, # If kind is TK_NUM, its value :str, # Token string :pos # Token position in user_input ) # Input program $user_input = nil # Current token $token...
true
2053d26abfd74d8781588c4c1a26d80dbc85dd24
Ruby
igel84/aquamarket
/app/models/cart.rb
UTF-8
1,869
3.109375
3
[]
no_license
class Cart attr_reader :items def initialize @items = [] end def add_product(product, product_type, quantity=1) if product_type == nil current_item = @items.find { |item| item.product == product } if current_item current_item.increment_quantity(quantity) else @items <...
true
baf3ebf0e5e55640d38fbc195448faefa85fe235
Ruby
Markhenn/LS-RB101
/Exercises/Advanced 1/ex7.rb
UTF-8
1,112
4.46875
4
[]
no_license
# Merge Sorted Lists # Problem # merge sorted lists one element at a time # input: 2 arrays # output: 1 array sorted # no mutation # how to do it: # if one array is empty add the rest of the other # compare first elements # write the smaller to to the new array # compare second and first -> write the smaller to arr...
true
719055ddb7fdd5c177db23083bf29ecb037877e1
Ruby
darrylclarke/CodeCore
/week1/2015.08.12/ternary.rb
UTF-8
90
3.0625
3
[]
no_license
a = true # Need ' ' after a or else it looks for a? method puts a ?"is true":"is false"
true
95d03ce2975de6986bfcca37e02f234bf66b2c5e
Ruby
Grifo89/Algorithms
/square_binary_search/ruby.rb
UTF-8
476
3.5625
4
[]
no_license
def sqrt(number) sqrt_recursive(number, 0, number) end def sqrt_recursive(number, min_interval, max_interval) return number if number == 0 || number == 1 ans = 0 start = min_interval end_ = max_interval while start <= end_ do mid = (start + end_)/2 return mid if mid * mid == number if mid * mid...
true
f888f7096e6a85084a556725a1ad659958491c14
Ruby
BenRKarl/WDI_work
/w01/d02/Tim_Hannes/guess_the_number.rb
UTF-8
390
3.8125
4
[]
no_license
def random_number user_input = nil x = rand(0-10) until user_input == x puts "Hello, please guess a number between 0 and 10." user_input = gets.chomp.to_i if x == user_input puts "Congrats!" #they got it right elsif user_input > x puts "Your guess was too high." elsif user_input < x ...
true
90d889b4f40613185aa8f5e260333a7372e86882
Ruby
OneCuteLiz/forms-and-basic-associations-rails-lab-cb-000
/app/models/song.rb
UTF-8
642
2.671875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Song < ActiveRecord::Base belongs_to :artist belongs_to :genre has_many :notes # The Song's genre def genre_name=(name) self.genre = Genre.find_or_create_by(name: name) end def genre_name self.genre ? self.genre.name : nil end # The Song's artist def artist_name=(name) self.artist = Artist.f...
true
8bfd3bade7e8556f35b7c3570660297dad3e5078
Ruby
schambers/learning-ruby
/scripts/callbacks.rb
UTF-8
548
4.28125
4
[]
no_license
# Callback without arguments def hello(name) puts "Hello #{name}" yield puts "Done saying hello to #{name}" end # Callback with arguments def hello_again(name) puts "Hello Again, #{name}" yield("Alan", "Chambers") puts "Done with hello_again" end def insert_space puts "\n\n" end hello('Sean') { puts 'in call...
true
e32c8485c847f588b27920b0aba34f6477655c5f
Ruby
peetucket/eol-ingestion-form
/app/models/entry.rb
UTF-8
1,963
2.625
3
[]
no_license
class Entry < ActiveRecord::Base include GeoKit::Mappable belongs_to :organism belongs_to :user has_many :images has_many :assets, :dependent => :delete_all has_many :data_points, :dependent => :delete_all has_enumerated :habitat validates_presence_of :date, :message=>"^Please enter the obser...
true
e48d2c8b5bde05e4c658c0d1472e06d6d7b78805
Ruby
xexiu/Ruby-ironhack
/accessor.rb
UTF-8
247
3.453125
3
[]
no_license
class Car attr_accessor :sound def initialize(sound) @sound = sound end def make_sound puts @sound end end my_car = Car.new "meeek" other_car = Car.new "moook" my_car.sound = "miiiiik" my_car.make_sound other_car.make_sound
true
e92f294a36922c20cb7e6aac6b0b8e34b046b88d
Ruby
cesarecamurani/chitter-challenge
/lib/user.rb
UTF-8
1,953
3.0625
3
[]
no_license
require 'pg' require 'bcrypt' require_relative './database_connection' require_relative './peep' class User attr_reader :id, :email, :name, :username def initialize(id:, email:, name:, username:) @id = id @email = email @name = name @username = username end def self.create(email:, password:, ...
true
6ee67907007ff4bed03f5363ba26691265d05e05
Ruby
LeeCooper6/Ternary
/Ternary.rb
UTF-8
2,379
4.59375
5
[]
no_license
# Binary is base 2 meaning binary numbers are 0 or 1. # Ternary is base 3 meaning ternary numbers are 0, 1, or 2. # This ternary allows -1, 0, or 1 for symmetry's sake. # This ternary "rotates" circularly through values: -1 => 0 => 1. # This ternary spins in either direction: -1 => 0 => 1 or 1 => 0 => -1. # This ternar...
true
b64190b96811c3df34548197067404a44cc0911a
Ruby
amcrawford/tealeaf_intro_to_programming_workbook_exercises
/easy_questions/quiz2.rb
UTF-8
1,186
3.5
4
[]
no_license
#1. ages = { "Herman" => 32, "Lily" => 30, "Grandpa" => 402, "Eddie" => 10 } ages.key?("Spot") #2. ages = { "Herman" => 32, "Lily" => 30, "Grandpa" => 5843, "Eddie" => 10, "Marilyn" => 22, "Spot" => 237 } def add_age(hash) total_age = 0 hash.each do |name, age| total_age = total_age + age end...
true
bcf96a5a0a9c3373ed58dd8584a0911cf1000398
Ruby
redxeagle/befdata
/test/unit/dataworkbook_test.rb
UTF-8
3,001
2.890625
3
[ "MIT" ]
permissive
require 'test_helper' require 'spreadsheet' class DataworkbookTest < ActiveSupport::TestCase def setup @dataset = Dataset.find(5) @spreadsheet = Spreadsheet.open @dataset.upload_spreadsheet.file.path @spreadsheet.io.close @book = Dataworkbook.new(@dataset.upload_spreadsheet) end test "workbook ...
true
87af9e6492afc03e6f6a32b1a7ecc2e40a8b45de
Ruby
jtp184/inkblot
/lib/inkblot/display.rb
UTF-8
3,314
3.09375
3
[]
no_license
module Inkblot # Singleton class for the e-Paper display class Display class << self # Set each time display is written to, represents what is being displayed attr_reader :current # Disambiguation function to take in an +obj+ and try to display it. # In order of resolution: # * An...
true