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
7cd62fd46230f6af59bc83f8a3faa88201f06cef
Ruby
ErinGreenhalgh/robot_world
/app/models/robot_manager.rb
UTF-8
872
2.859375
3
[]
no_license
class RobotManager attr_reader :database def initialize(database) @database = database end def table database.from(:robots).order(:id) end def create(robot_data) table.insert( name: robot_data[:name], city: robot_data[:city], state: robot_data[:state], avatar: robot_da...
true
d4f82ec08a2756c6fde1efd74ed63dbd0cbb4def
Ruby
pbosetti/rosar
/lib/rosar.rb
UTF-8
3,032
2.921875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # # Created by Paolo Bosetti on 2008-05-22. # Copyright (c) 2008 University of Trento. All rights # reserved. require 'singleton' require 'rubygems' require "rubyosa" =begin rdoc Adds a to_r method to standara Arrays, which returns a String representation of the equivalent R array object. =end...
true
dd4a50abc4fe40c8e5146c9917c3f042d528742a
Ruby
ap2322/ruby-exercises
/mythical-creatures/spec/wizard_spec.rb
UTF-8
1,512
3.140625
3
[]
no_license
require 'spec_helper' require_relative '../lib/wizard' describe Wizard do it "creates a Wizard class" do wiz = Wizard.new("greg") expect(wiz.class).to eq Wizard end end # # class WizardTest < Minitest::Test # def test_has_name # wizard = Wizard.new("Eric") # assert_equal "Eric", wizard.name # ...
true
fb03577a273dca831ad63a0785cfae5c6acf2e02
Ruby
username0x0a/pes.misacek.net
/pes.rb
UTF-8
2,672
2.8125
3
[]
no_license
#!/usr/bin/env ruby require 'net/https' require 'json' require 'fileutils' require 'pp' class String def getValue(*args) throw :too_few_arguments if args.size < 1 patterns = args[0..-2] terminator = args[-1] start = 0 end_ = 0 patterns.each do|pattern| start = self.index(pattern, start) start += pa...
true
0ad8b04be92a643b6e8d261f12e70acb0a3f0648
Ruby
earbits/requirejs-rails
/lib/requirejs/dependency_builder.rb
UTF-8
915
2.75
3
[ "MIT" ]
permissive
require "set" module Requirejs class DependencyBuilder attr_reader :env attr_reader :cached_paths def initialize(dependancy_adapter) @env = dependancy_adapter @cached_paths = Set.new end def include(logical_path) cached_paths << logical_path # build sub dependencies ...
true
59ad8d465e1ad3523a1568acae32a62ad8b7103a
Ruby
Ditofry/colorado-alarm-api
/test/models/city_test.rb
UTF-8
483
2.53125
3
[]
no_license
require 'test_helper' class CityTest < ActiveSupport::TestCase test "City requires name" do assert_not City.new(name: nil, state: 'Colorado').valid? end test "City requires state" do assert_not City.new(name: 'Boulder', state: nil).valid? end test "City address method will return properly contatena...
true
6cc4ed9921e04617a6f604c4931d8d3ea8bd37ec
Ruby
loganhasson/school-domain-old
/lib/student.rb
UTF-8
922
3.171875
3
[]
no_license
class Student attr_accessor :name, :twitter, :linkedin, :github, :website attr_reader :id @@all_students = [] @@current_id = 0 def initialize(data=nil) data.each do |key, value| self.send("#{key}=",value) end unless data.nil? @@all_students << self @id = Student.get_...
true
b1297c9407bb75852fe11193df7f4b3d86873285
Ruby
myronmarston/string_to_integer
/spec/string_to_integer_spec.rb
UTF-8
394
2.578125
3
[]
no_license
require 'spec_helper' describe "StringToInteger#to_integer" do -100.upto(100) do |i| it "converts '#{i}' to #{i}" do i.to_s.to_integer.should == i end end it 'raises an error for "-ab"' do expect { '-ab'.to_integer }.should raise_error(ArgumentError) end it 'raises an error for "ab"' do ...
true
3dcc307ebec6f1fc37a3a49b2a224a58a3c42c0f
Ruby
adam-barton/rails-amusement-park-v-000
/app/models/attraction.rb
UTF-8
671
2.578125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Attraction < ActiveRecord::Base validates :name, presence: true validates :nausea_rating, presence: true validates :happiness_rating, presence: true validates :tickets, presence: true validates :min_height, presence: true validates :nausea_rating, numericality: { only_integer: true } validates :hap...
true
897d95202e0cdda41774bf5054ec6b2b88c7b325
Ruby
oicitrapdraz/ruqqus-metrics
/app/services/api/request.rb
UTF-8
995
2.515625
3
[]
no_license
# frozen_string_literal: true require 'net/http' module API class Request attr_reader :url, :method, :body, :headers ACCEPTED_METHODS = %w[get post].freeze def initialize(url, method, body = nil, headers = nil) @url = url @method = method @body = body @headers = headers end...
true
7da74225fc497e32ae1a743f1822e2f038af0301
Ruby
zerofalcon00/ttt_class
/test_class_unbeatable_ai.rb
UTF-8
1,957
3.046875
3
[]
no_license
require "minitest/autorun" require_relative "class_unbeatable_ai.rb" class TestUnbeatableAI < Minitest::Test def test_create_new_player player = UnbeatableAI.new("X", "josh") assert_equal("X", player.marker) assert_equal("josh", player.name) end # def test_win_spot_for_X # player = UnbeatableA...
true
4cf8693045542ed34fc5e35eddc219ccff39b6c6
Ruby
msgalenwhite/NewsletterApp
/app/models/invitation_batch.rb
UTF-8
1,116
2.59375
3
[]
no_license
class InvitationBatch attr_reader :errors, :invitees def initialize(options) @invitees = options[:invitees] @host = options[:host] @newsletter = options[:newsletter] @invitations = form_invitations @errors = [] end def dispatch if all_valid? @invitations.each {|i| i.save! } ...
true
af662f7f68c1c73098ed8813f42bcfc5961527ea
Ruby
eugenenelou/objective-progress
/fullstack_1/backend/level_2/main.rb
UTF-8
1,053
2.890625
3
[]
no_license
require 'json' require 'date' file = File.read('data/input.json') data = JSON.parse(file) objectives = data['objectives'] progress_records = data['progress_records'] objectives_by_id = {} objectives.each do |objective| objectives_by_id[objective['id']] = objective end result = [] progress_records.each do |progres...
true
bb1fa927cbf97011284a3496c4a0c7eb8d310ad0
Ruby
katelynsills/libertyautomator
/libertyautomator.rb
UTF-8
2,704
2.75
3
[]
no_license
require 'rubygems' require 'nokogiri' require 'restclient' require 'csv' require 'gmail' gmail_address = 'puthere' gmail_password = 'puthere' REQUEST_URL = "http://www.libertyguide.com/jobs/" form_page = Nokogiri::HTML(RestClient.get(REQUEST_URL)) radius = 10 zip = 'City%2C+State%2C+Zip%2C+or+Address' searchingJo...
true
f1bedb90157de8f39059b6b5bc39162d832ba92e
Ruby
mattdvhope/myflix
/app/controllers/password_resets_controller.rb
UTF-8
2,330
2.59375
3
[]
no_license
class PasswordResetsController < ApplicationController def show # We're trying to show the 'Reset your Password' page here. If the token is valid, we'll render the view template, but if it's not valid, then we'll redirect_to the '/invalid token' ('Your reset password link is expired') page. user = User.where(tok...
true
21beb5506ce06b277cb2cd93e47f81e2e5a23a0d
Ruby
evysan/EjerciciosRuby
/dividir_100.rb
UTF-8
101
2.96875
3
[]
no_license
def cien_entre(numero) 100 / numero rescue puts 'Intenta con otro numero' end puts cien_entre(0)
true
2d50b03defcfe1d8031c3fb9b88649048c7dffd8
Ruby
ktbliz/anagram-detector-online-web-pt-021119
/lib/anagram.rb
UTF-8
370
3.515625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Anagram attr_accessor :word def initialize(word) self.word = word end def match(anagrams_array) word_chars_array = self.word.split("").sort matches_array = [] anagrams_array.each do |anagram| if anagram.split("").sort == word_chars_array matches_array << anagram ...
true
9cfa9972ba68f8e35a429692b6fc3d966233c2d9
Ruby
johnjvaughn/ls_course101
/SmallProblems/Medium1/rotation_part1.rb
UTF-8
653
4.21875
4
[]
no_license
def rotate_array(arr) return [] if arr.empty? newarr = arr.clone newarr << newarr.shift end def rotate_string(str) rotate_array(str.chars).join end def rotate_integer(num) num = num.abs.round rotate_string(num.to_s).to_i end rotate_array([7, 3, 5, 2, 9, 1]) == [3, 5, 2, 9, 1, 7] rotate_array(['a', 'b', '...
true
33457533383e6f0b9bc35f27a376e46f3c413368
Ruby
miguelnietoa/ruby-basics
/08-ArraysI/pop_method.rb
UTF-8
157
3.46875
3
[]
no_license
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] p arr last_item = arr.pop p arr p last_item item = arr.pop(1) p arr p item two_items = arr.pop(2) p arr p two_items
true
8185634d48ba521a075b98f5ee311f0150b542ff
Ruby
MarkMT/fragmentary
/lib/fragmentary/widget.rb
UTF-8
970
2.765625
3
[ "MIT" ]
permissive
module Fragmentary class Widget attr_reader :template, :match def self.inherited subclass super if defined? super @subclasses ||= [] @subclasses << subclass end def self.subclasses @subclasses ||= [] @subclasses.inject([]) do |list, subclass| list.push(subclass...
true
89bcd699d66cba119613fa64000c986e545b374c
Ruby
austinckohler/ruby-enumerables-hash-practice-emoticon-translator-lab-denver-web-033020
/lib/translator.rb
UTF-8
728
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "yaml" def load_library(lib) library = YAML.load_file(lib) result = {"get_meaning" => {}, "get_emoticon" => {}} library.each do |m, e| result["get_meaning"][e[1]] = m result["get_emoticon"][e[0]] = e[1] end result end def get_japanese_emoticon(file_path = './lib/emoticons.yml', emoticon) library = load...
true
ddbfb3ea85369b99fb4b73016662b21e1668c064
Ruby
fiteclub/2020_advent
/helpers.rb
UTF-8
743
3.4375
3
[]
no_license
require 'rainbow' require 'terminal-table' require 'pry' def colorize(item) case item when Integer Rainbow(item.to_s).yellow.bright when String Rainbow(item).green when FalseClass Rainbow(item.to_s).red when TrueClass Rainbow(item.to_s).green when NilClass Rainbow('nil').white else ...
true
142dfa47699d1c6805a371e252e26dd237429368
Ruby
iovino/ruby-forum
/app/controllers/forums_controller.rb
UTF-8
7,511
2.609375
3
[]
no_license
class ForumsController < ApplicationController # /forums def index @forumbits = build_forums_list @lightbulbs = fetch_unread_forums @lastposts = fetch_lastposts @forumbits.map(&:last_post_id).flatten.delete_if {|x| x == 0 } end # /forums/:id def show perpage = 25 page = params[:page]...
true
e775618d8d27d8305d50875e25edfb1c5ae032b8
Ruby
Elenadinca25/programming-univbasics-nds-nested-arrays-iteration-lab-part-2-lon01-seng-ft-042020
/lib/iteration_with_loops.rb
UTF-8
290
2.96875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def find_min_in_nested_arrays(src) new_array = [] i = 0 while i < src.length do new_array << src[i].min i += 1 end new_array end def find_greater_pair(src) new_array = [] i = 0 while i < src.length do new_array << src[i].max i += 1 end new_array end
true
82ba2b15a1de2e359bdba3041fb23ae4e81980b5
Ruby
RWashington2014/cartoon-collections-v-000
/cartoon_collections.rb
UTF-8
745
3.53125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def roll_call_dwarves(dwarves) dwarves.each_with_index do |name, num| puts "#{num + 1} #{name}" end end def summon_captain_planet(elements) elements.collect {|elem| "#{elem.capitalize}!"} end def long_planeteer_calls(words) words.any? { |word| word.length > 4 } end def find_the_cheese(cheeses) # the a...
true
cf2da4d94d1d04c5df6e877d9d7e6ba8267302d4
Ruby
kevinday/project-euler
/6.rb
UTF-8
245
3.390625
3
[]
no_license
def sumOfSquares(n) result=0 n.times do |i| result += (i+1)**2 end result end def squareOfSums(n) result=0 n.times do |i| result += (i+1) end result = result**2 end num=100 puts squareOfSums(num) - sumOfSquares(num)
true
97fd395574d9a5b3fc71e52008ef0231172f6eab
Ruby
agsutter/101-109_small_problems
/easy6/delete_vowels.rb
UTF-8
450
4.25
4
[]
no_license
# Write a method that takes an array of strings, and returns an array of the # same string values, except with the vowels (a, e, i, o, u) removed. def remove_vowels(array) vowels = %w(a e i o u) array.map!(&:chars) array.map { |ary| ary.delete_if { |chr| vowels.include?(chr.downcase) } } array.map(&:join) end ...
true
729de6d10279e4b74b4ea96475fd31078b39ec85
Ruby
AlexStoll/RB101
/lesson_5/practice_10.rb
UTF-8
280
3.40625
3
[]
no_license
# Without modifying original array # use map to return a new array identical in structure # with each integer incremented by 1 [{a: 1}, {b: 2, c: 3}, {d: 4, e: 5, f: 6}].map do |hsh| new_hash = {} hsh.each do |key, value| new_hash[key] = value + 1 end p new_hash end
true
d5050c70eb5dfc7972fbb54ee93b46a31a442a48
Ruby
Megscode/bank_test
/lib/statement.rb
UTF-8
377
3.0625
3
[]
no_license
class Statement attr_reader :transaction def initialize(transaction = Transaction.new) @transaction = transaction end def header "date || credit || debit || balance" end def print_transactions puts header transaction.transaction_history.reverse.each do |transaction| puts transacti...
true
afcd22771b68fd42394706a44cac5062078a7826
Ruby
mkroman/runtime
/library/runtime/manager.rb
UTF-8
538
2.578125
3
[]
no_license
# encoding: utf-8 Thread.abort_on_exception = true module Runtime class Manager def initialize @pool = Pool.new @thread = spawn_thread end def manage @pool.each_event_at current_time do |event| @pool.drop event event.pull end end def add_event event ...
true
288055b064157e2f4572fef61782677a142c89ad
Ruby
llusardo/RoR-API
/app/models/animal.rb
UTF-8
3,210
2.75
3
[]
no_license
# == Schema Information # # Table name: animals # # id :integer not null, primary key # chip_num :string # name :string not null # race :string # sex :integer not null # vaccines :boolean # castrated :boolean # admission_dat...
true
7e6f66f25fd580c26e97ca859af07cfa4e7b3426
Ruby
mkrahu/launchschool
/exercises/small_problems/vers1/easy_4/convert_string_to_number.rb
UTF-8
1,043
4.28125
4
[]
no_license
# convert_string_to_number.rb # Convert a String to a Number! exercise # Small Problems exercises from LaunchSchool STRING_INTEGER_MAP = { '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, '0' => 0 } HEX_INTEGER_MAP = { '0' => 0, '1' => 1, '2' => 2, '...
true
b2e4bc988e5a07782dd483f8989f78d27d78b2d8
Ruby
toomanyadverbs/mbta_for_you
/bin/app.rb
UTF-8
1,336
3.765625
4
[]
no_license
require 'pry' # require_relative '../lib/station' require_relative '../lib/line' require_relative '../lib/subway_system' # the variable named station value will be set/assigned # the Station object with a name of 'alewife' # station = Station.new('alewife') # puts "station name is #{station.name}" # Create an insta...
true
5eb3895f1f086e83852e8234c9a53b4a3be1aa4b
Ruby
zhongnan21/rubytest
/controller.rb
UTF-8
138
3.09375
3
[]
no_license
radiation =200 if radiation > 100 puts 'Danger' end puts 'Danger' if radiation > 150 while radiation > 100 puts radiation -=20 end
true
530b0896e18fec8aea7e47b9544ce4bbe888be0e
Ruby
teksymmetry/reek
/spec/reek/smells/utility_function_spec.rb
UTF-8
2,284
2.609375
3
[]
no_license
require File.dirname(__FILE__) + '/../../spec_helper.rb' require 'reek/smells/utility_function' include Reek include Reek::Smells describe UtilityFunction do it 'should not report attrset' do class Fred attr_writer :xyz end Fred.should_not reek end it 'should count usages of self'do 'de...
true
1795c8cc7c39b9d07a3e3297abc7d2436636c26f
Ruby
PeterK1903/Week_2_weekend_homework
/Guest.rb
UTF-8
320
3.0625
3
[]
no_license
class Guest attr_accessor :name, :age, :cash, :favesong def initialize(name, age, cash, favesong) @name = name @age = age @cash = cash @favesong = favesong end def guest_paying_fee(value) @cash -= value end def guest_cheering return "Woo! Pass the mic, i'm oan first!" end end
true
8d823a4b259d0f74a174fa7459043cae800f749c
Ruby
carolquan/ruby_study
/等额本金.rb
UTF-8
279
3.140625
3
[]
no_license
puts "请输入贷款本金" loan_p = gets.to_i puts "请输入贷款利率" r = gets.to_f loan_r = r/100 puts "请输入贷款年限" loan_y= gets.to_i n=1 while n<=loan_y*12 print "第#{n}期还款:" p loan_p/12/loan_y+(loan_p-loan_p/12/loan_y*(n-1))*loan_r/12 n+=1 end
true
793af9ab8ff9cdb4424d87c20a8b6d865a13d9da
Ruby
Maverick94/PDOO_Napakalaki_15-16
/PDOO_Napakalaki_RUBY/lib/PruebaNapakalaki.rb
UTF-8
5,832
2.734375
3
[]
no_license
#!/bin/env ruby # encoding: utf-8 module PruebaNapakalaki require_relative 'monster.rb' require_relative 'bad_consequence.rb' require_relative 'prize.rb' require_relative 'treasure_kind.rb' monsters = Array.new # Los hondos bc = BadConsequence.new_death("Estos monstruos resultan bastante superficiales y...
true
57c2f2ef7dd00a8ab1fa22611d1ddad6a7f18b13
Ruby
RyanScottLewis/backlight_sensor
/lib/backlight_sensor/controller.rb
UTF-8
1,279
3.140625
3
[ "MIT" ]
permissive
module BacklightSensor class Controller # Open the USB device # # @param [String] path The path to the USB device def self.open(path, &block) new.open(path, &block) end # Open the USB device # # @param [String] path The path to the USB device def open(path, &block) @io...
true
3db12ecafefc157bb20f970d250c6c88bb6b5d09
Ruby
AlexandraChen/tweetsec
/tweetsec.rb
UTF-8
1,459
3.390625
3
[]
no_license
class Tweetsec def initialize(password) @password = password end def split_word(str) @result = [] chas = str.split("") len = chas.size (0..len-1).each do |i| (i..len-1).each do |j| @result << chas[i..j].join end end find_matches end def find_matches m...
true
1326d874d2fe32e788cd7ecb6b0b72058bcfea4e
Ruby
uchiyu/NLP100
/07/62.rb
UTF-8
391
3.046875
3
[]
no_license
=begin 62. KVS内の反復処理 60で構築したデータベースを用い,活動場所が「Japan」となっているアーティスト数を求めよ. =end require "redis" redis = Redis.new count = 0 redis.keys.each do |key| count = count + 1 if redis.get(key.chomp) == 'Japan' #print key, ' ', redis.get(key.chomp), "\n" if redis.get(key.chomp) == 'Japan' end puts count
true
5ce5459b1333f5687ad9e3f0789c2886a95f5128
Ruby
jindai1783/Practice_Ruby_3
/lib/questions.rb
UTF-8
9,645
4.21875
4
[]
no_license
# keep only the elements that start with an a def select_elements_starting_with_a(array) array.select {|x| x[0] == 'a'} # array.keep_if {|a| a =~ } end # keep only the elements that start with a vowel def select_elements_starting_with_vowel(array) array.select {|x| x[0] =~ /^[aeiou]/} end # remove instances of ...
true
37dcee4deaff2c5139022fd7e1a647752a2f89ad
Ruby
runeb/adventofcode2017
/5.rb
UTF-8
1,079
3.484375
3
[]
no_license
# https://adventofcode.com/2017/day/5 require "minitest/autorun" require "benchmark" def step(jumplist) list = jumplist.split.map(&:to_i) head, step = 0, 0 while instruction = list[head] list[head] += 1 head += instruction step += 1 end step end def step2(jumplist) lis...
true
ffddcdf6f032047c0b307208761207f88d658d92
Ruby
sgonyea/jquery-governance
/app/models/motion_state/base.rb
UTF-8
634
2.578125
3
[]
no_license
module MotionState class Base def initialize(motion) @motion = motion end def permit?(action, member) method = "permit_#{action}?" public_send(method, member) if self.respond_to?(method) end def permit_see?(member) end def permit_second?(member) end def permit...
true
8c595a646d527a55512de47b6d415beaea031c9e
Ruby
rebeccabosse/ruby
/exo_20.rb
UTF-8
265
3.28125
3
[]
no_license
print "Salut, bienvenue dans ma super pyramide ! Combien d'étages veux-tu ? " puts '>' n = gets.chomp.to_i if n > 25 puts " Désolé pas de pyramide" else n < 25 puts'Voici la pyramide :' 1.upto(n) do |k| k.times { print "#" } puts end end
true
88847e61f52adbb3a82ee0d2f4f94973e68cc17e
Ruby
Zamyatin/LearningRuby
/calc.rb
UTF-8
144
3.6875
4
[ "MIT" ]
permissive
x = 2 y = "25" puts x.to_s + y puts "" puts x + y.to_i puts "" puts "" z = y.to_f / x.to_f puts "" puts "Half of 25 is #{z}." puts 4.to_f / 3
true
7c4221224ae318dab88c629d1adb1668395fa71d
Ruby
ericluo/east
/bin/east.thor
GB18030
2,992
2.59375
3
[]
no_license
# encoding: GBK require 'thor' require 'pathname' require 'open3' require 'logger' require '../lib/east' module East class Data < Thor FN_REGEXP = /^(?<license_num>\w+)-(?<interface_name>\w+)-(?<gather_data>\d+)$/ MAPPER = YAML.load_file('../config/mapper.yaml') LICENSE_NUMBER = 'B0187H24...
true
822219060c703bd6417ef5d41257e4b160ffb2c2
Ruby
m4i/xrea-cron
/lib/cron/crontab/date_field.rb
UTF-8
4,816
2.796875
3
[]
no_license
require 'cron/crontab' module Cron module Crontab module DateField class ParseError < Crontab::ParseError; end class Base class << self def min(min = nil) min ? (@min = min) : @min end def max(max = nil) max ? (@max = max) : @max ...
true
7bc0f0bfa5930f91572b7d2e7fca180bfedb7ebb
Ruby
0exp/qonfig
/lib/qonfig/compacted/constructor.rb
UTF-8
3,282
2.546875
3
[ "MIT" ]
permissive
# frozen_string_literal: true # @api private # @since 0.21.0 module Qonfig::Compacted::Constructor # @return [NilClass] # # @api private # @since 0.21.0 NO_INITIAL_DATA_SET = nil class << self # @param compacted_config [Qonfig::Compacted] # @param initial_data_set [NilClass, Qonfig::DataSet] #...
true
52db8e60742ff9d05f523784eafa58be8b5d70d8
Ruby
MGellman88/Ruby-on-Rails
/yieldandblock.rb
UTF-8
294
4.15625
4
[ "MIT" ]
permissive
def test yield (5) puts "You are in the method" yield (100) end test {|i| puts "You are in the block #{i}"} def square(num) puts "num is #{num}" x = yield(num) puts "x has a value of #{x}" y = yield(num)*x puts "y has a value of #{y}" end square(5) {|i| i*i}
true
f75ca99769bb30a3cef0c8e13e79a00ec8a63d32
Ruby
tribbyfam/learning-Ruby
/Practice/library_book/code/Ch 5 programs/5-6.rb
UTF-8
105
3.90625
4
[]
no_license
puts "Count from 0 to ? " n = gets.to_i i = 5 while (i > 0) i = i + 2 end
true
1e0fdb71b15a701b20bb10e156af59e22a72504a
Ruby
menja-coder/PROJET
/exo_10.rb
UTF-8
306
3.6875
4
[]
no_license
puts "Saisissez votre année de naissance si vous êtes nés avant 2017" birth = gets.chomp.to_i #On doit changer birth, qui est un string, en integer if birth<2017 age = 2017-birth puts "En 2017, vous avez #{age}!!!" else puts "Vous êtes nés avant 2017 ? Vérifier bien ce que vous Saisissez" end
true
04772875f569571a138c788d9c2df8d9ea5a208b
Ruby
my-nguyen/projecteuler.net
/euler_026.rb
UTF-8
1,582
3.6875
4
[]
no_license
# for an explanation on how to find the recurring cycles, refer to # http://www.mathblog.dk/project-euler-26-find-the-value-of-d-1000-for-which-1d-contains-the-longest-recurring-cycle/ # this is a convenience class to bundle several pieces of information to return # to the caller class Decimal attr_accessor :data, :...
true
f9794210f5027e9e358b2f8cb289c794e6b20e40
Ruby
lewis88/dodgeball_league
/db/db_methods.rb
UTF-8
517
2.921875
3
[]
no_license
class DatabaseMethods def self.map_items(sql) pokemons = SqlRunner.run(sql) result = pokemons.map { |pokemon| Pokemon.new( pokemon ) } return result end def self.map_item(sql) result = Pokemon.map_items(sql) return result.first end def save( table, *args ) sql = "INSERT INTO #{ tab...
true
a87ba63cff5ef460ffd482ea9568168eb8c8ad79
Ruby
HungryAnt/yecai-chat-room-server
/server/src/dao/user_nutrient_dao.rb
UTF-8
1,445
2.90625
3
[]
no_license
class UserNutrientDao < DaoBase NUTRIENTS_COUNT = 3 def clear execute do |conn| conn.query('delete from v1_user_nutrients') end end def count r = nil execute do |conn| r = conn.query('select count(*) from v1_user_nutrients').fetch end r[0].to_i end def...
true
48c8211445141ea17c5f8085bb77a0f926f40575
Ruby
Unbabel/unbabel-ruby-wrapper
/lib/unbabel/client.rb
UTF-8
1,193
2.546875
3
[ "MIT" ]
permissive
module Unbabel class Client TEST_MODE = ENV['UNBABEL_SANDBOX'] == 'true' SANDBOX = 'http://sandbox.unbabel.com/tapi/v2' ENDPOINT = TEST_MODE ? SANDBOX : 'https://unbabel.com/tapi/v2' include Unbabel::LanguangePair include Unbabel::Topic include Unbabel::Tone include Unbabel::Translatio...
true
8f5bb803966e5f45a93e2000fd3cc3ee20c1f013
Ruby
gabrieltong/rails-wanguo
/app/models/search.rb
UTF-8
1,989
2.578125
3
[]
no_license
class Search < ActiveRecord::Base # Limit = 15 attr_accessible :keyword, :result, :searchable, :user_id belongs_to :user serialize :result validates :user,:action,:result,:presence => true def self.validate_law_roots keyword,parents=Law.roots result = parents.select do |item| !item.subtree.where...
true
8ca595fb5ac0d305b99019375ebb71d680dcc4a8
Ruby
viniciuspalma/vayne
/app/services/compare_versions/compare_attributes.rb
UTF-8
754
2.90625
3
[]
no_license
module CompareVersions class CompareAttributes def initialize(attributes:, object:) @attributes = attributes @object = object end def compare(compare_object) verified_attributes(compare_object) end private attr_accessor :attributes, :object def verified_attributes(com...
true
5d674eed99259bbccbe3f9048b717459e24657ba
Ruby
Kr00nan/magic_8ball
/magic_8ball.rb
UTF-8
810
3.640625
4
[]
no_license
require_relative "m8b_classes" require "colorize" require "pry" class Main def initialize @magic_eight_ball = MagicEightBall.new @answer = "" puts "\nWelcome to the Magic Eight Ball".colorize(:blue) menu end def menu puts "\nType a question to get an answer, or type QUIT to end the program"....
true
315f8780305ea1b600a99c53d3fd8aad07210eca
Ruby
nasa/Common-Metadata-Repository
/orbits-lib/resources/orbits/coordinate.rb
UTF-8
2,321
3.484375
3
[ "Apache-2.0" ]
permissive
module Orbits class Coordinate include Math def self.lat_lon(lat, lon) phi = lat * PI / 180 theta = lon * PI / 180 phi_theta(phi, theta) end def self.xyz(x, y, z) d = x*x + y*y + z*z d = x = 1 if d == 0 # Should never happen, but stay safe # We normalize so that ...
true
ee06b7515e422f311a5efed2c1cf74165905df99
Ruby
davispuh/CLI-Console
/spec/cli-console_spec.rb
UTF-8
5,910
2.859375
3
[ "Unlicense", "LicenseRef-scancode-public-domain-disclaimer", "LicenseRef-scancode-public-domain" ]
permissive
require 'spec_helper' class UI private extend CLI::Task public usage 'Usage: try' desc 'try exception' def try(params) raise Exception, params[0] end end describe CLI::Console do let(:input) { StringIO.new } let(:output) { StringIO.new } let(:io) {...
true
02013f31ea71cb51d2df1d1a315b425253e5de36
Ruby
gemeraldbeanstalk/bean_counter
/lib/bean_counter/enqueued_expectation.rb
UTF-8
6,120
2.703125
3
[ "MIT" ]
permissive
class BeanCounter::EnqueuedExpectation extend Forwardable def_delegators BeanCounter, :strategy # The Hash of options given at instantiation that the expectation expects when # matching. # @return [Hash] attr_reader :expected # The number of matching jobs the expectation expects # @return [Numeric, ...
true
38b4e1e36865291d39d8fa0c23e1b4d506e6dfd8
Ruby
newmanbradm/pokemon-scraper-nyc-web-060418
/lib/pokemon.rb
UTF-8
932
3.34375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Pokemon attr_reader :name, :type, :id, :db, :hp def initialize(props = {}) @name = props['name'] @type = props['type'] @id = props['id'] @hp = props['hp'] @db = props['db'] end def self.save(name, type, db) sql_string = <<-SQL_STRING INSERT INTO pokemon (name, type) VALUES...
true
33c6f6ed22c4fa291955806ac27d6b84b3a9bfc0
Ruby
pujiepie/rspec-fizzbuzz-dumbo-web-career-021819
/fizzbuzz.rb
UTF-8
310
3.1875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Don't forget! This file needs to be 'required' in its spec file # See README.md for instructions on how to do this def fizzbuzz(int) if int % 15 == 0 return "FizzBuzz" end if int % 3 == 0 # if the number int is divisible by 3 return "Fizz" # Go fizz end if int % 5 == 0 return "Buzz" end end
true
aa3058eb74bbf3295ac22121c7040f2db0f758a2
Ruby
cph/mdb
/lib/mdb/database.rb
UTF-8
2,590
2.640625
3
[ "MIT" ]
permissive
require "tempfile" require "shellwords" require "csv" module Mdb class Database def initialize(file, options={}) file = file.to_path if file.respond_to?(:to_path) raise FileDoesNotExistError, "\"#{file}\" does not exist" unless File.exist?(file) @file = file @delimiter = options.fetc...
true
eec01eae039266e2a63e3ca7d00ad0c0871f6a7d
Ruby
charlesghost/ToolsQAFramework
/features/lib/pages/demoqa_register.rb
UTF-8
1,903
2.609375
3
[]
no_license
require 'capybara/dsl' class DemoQaRegister include Capybara::DSL attr_accessor :register_link_text, :username_id, :email_id, :register_button_id, :reset_password, :reset_button_id, :register_account_username, :register_email, :registration_completed_message, :registration_register_link, :registration_confir...
true
03ccfcda17d73d26aa5962b3bd1649bb9d789f42
Ruby
FrutosGaston/PagosMercado
/app/models/credit_card.rb
UTF-8
1,223
3.125
3
[]
no_license
class CreditCard INVALID_DATE_ERROR = 'La fecha de expiracion ya paso'.freeze INVALID_NUMBER_ERROR = 'El numero de tarjeta no existe'.freeze INVALID_NAME_ERROR = 'El nombre del portador es invalido'.freeze VALID_CARD_NUMBER = '4509953566233704'.freeze VALID_NAME = 'APRO'.freeze VALID_CVV = '123'.freeze a...
true
68da20f01a92aed8868135c888f2c36b75f5e59b
Ruby
SevenMatt/Ruby
/default.rb
UTF-8
120
2.984375
3
[]
no_license
=begin def oi(nome) puts "oi #{nome}" end oi ("Matheus") =end def oi (nome = "Matheus") puts "oi #{nome}" end
true
fef6844aa449cdfcd391c597fcd1babe372673f4
Ruby
Deepak275/nosql_db
/lib/nosql_db/delete.rb
UTF-8
881
2.828125
3
[ "MIT" ]
permissive
require 'json' module NosqlDb class Delete attr_accessor :file_data, :key, :value def initialize(input) @file_data = File.read("store.json") @key, @value = *(input.split(',')) end def find_and_delete sleep_if_writting json_store = JSON.parse(@file_data) json_...
true
5ded79fb40fdfab468452045df74998112bf096d
Ruby
cesarcatanio/ruby_example
/app/models/user.rb
UTF-8
1,151
2.78125
3
[]
no_license
#Este archivo es el objeto de modelo User #La clase User hereda de ActiveRecord::Base #esto permite que el modelo User tenga toda la funcionalidad de la clase ActiveRecord #Gracias a las convenciones de nombre de ActiveRecord transforma a user en prural users #generando un archivo de migración en el cual su nombre es u...
true
cee950b08d3b6ba7dc00c9b95af42f7510500a6f
Ruby
neilmarion/ttanalyzer
/app/models/zscore_historical.rb
UTF-8
549
2.640625
3
[]
no_license
class ZscoreHistorical < ActiveRecord::Base belongs_to :term def ave(plus_n) self.sum.to_f/(self.n.to_f + plus_n.to_f) end def std(plus_n) #(Math.sqrt((term.zscore_historical.sqr_total.to_f / term.zscore_historical.n.to_f + plus_n)-(term.zscore_historical.sum.to_f/term.zscore_historical.n.to_f)**2 ) ...
true
9059ac5592f3e55e4f1f8ee53318a98606a6f2d3
Ruby
bracken/delayed_job
/lib/delayed/performable_method.rb
UTF-8
1,388
2.78125
3
[ "MIT" ]
permissive
class Class def load_for_delayed_job(arg) self end def dump_for_delayed_job name end end module Delayed class PerformableMethod < Struct.new(:object, :method, :args) STRING_FORMAT = /^LOAD\;([A-Z][\w\:]+)(?:\;(\w+))?$/ class LoadError < StandardError end def initialize(object...
true
55d8e990831bbd33ec41f9c91a6ac47d61714f90
Ruby
ajrussellaudio/record_store
/models/album.rb
UTF-8
1,435
3.28125
3
[]
no_license
require_relative "../db/sql_runner" class Album attr_reader :id, :name, :artist_id def self.all() sql = "SELECT * FROM albums;" return Album.map_items(sql) end def self.delete_all() sql = "DELETE FROM albums;" SqlRunner.run(sql) end def self.find(id) sql = "SELECT * FROM albums WHER...
true
7a5c88c9e6fbafc4be415fb6cb136e7fc0942166
Ruby
kwong2/codewars
/ruby/middlecharacter.rb
UTF-8
1,059
4.375
4
[]
no_license
# https://www.codewars.com/kata/56747fd5cb988479af000028/train/ruby # You are going to be given a word. Your job is to return the middle character of the word. If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters. # #Examples: # Kata.getMiddle("test") ...
true
c2acc2657cd3aea65cf4c8fc64b8deb1017a2770
Ruby
scottkf/flipware
/spec/models/person_spec.rb
UTF-8
1,138
2.765625
3
[]
no_license
require 'spec_helper' describe Person do before(:each) do @p1 = Person.new(:first_name => "Jim", :last_name => "Tesoriere") @p2 = Person.new(:first_name => "John", :last_name => "Levowitz") @p3 = Person.new(:first_name => "Steve", :last_name => "Schwart") @p4 = Person.new() end context "#vali...
true
463bf7b6366e0056fc3377536babbda0412f8e5c
Ruby
SalMac86/array-methods-lab-cb-000
/lib/array_methods.rb
UTF-8
413
3.625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def using_include(array, element) array.include?(element) #return true if element is included in array end def using_sort(array) array.sort #returns the sorted array without modification end def using_reverse(array) array = array.reverse #returns a reversed version of the array end def using_first(array) arr...
true
4b31d52b109cf98f8c328e57e06e0878a8ca7e7c
Ruby
chrismv48/money_master_v2
/app/lib/plaid_api.rb
UTF-8
3,684
2.515625
3
[]
no_license
require 'plaid' require 'active_support/all' # Item: a set of credentials at a financial institution; each Item can have many Accounts, and some Accounts have Transactions associated with them # client_id and secret: two private API keys; used in conjunction with an access_token to access data for an Item # public_key...
true
7fdf912cb1c20d1f58f7a21dd007202d48c1c99b
Ruby
saralis/phase-0
/week-5/gps2_2.rb
UTF-8
2,258
4.34375
4
[ "MIT" ]
permissive
# Method to create a list <-- 1 # input: string of items separated by spaces (example: "carrots apples cereal pizza") # steps: # Create a container that holds an array of strings # split input string by white space # create new empty hash # Add each word in the array to hash as the key # set default quantity ...
true
0715c32b7806d41dc0b0d159c5952b8caf276f4e
Ruby
gngo2018/RubyFundamentals
/06_CalculatorExample.rb
UTF-8
271
4.28125
4
[]
no_license
# Ruby always reads input into a string # Note module 05 with Numbers and Math puts "Enter a number:"; num1 = gets.chomp().to_f; puts "Enter another number:" num2 = gets.chomp().to_f; # .to_i converts into integer # .to_f converts into float (decimal) puts (num1 * num2);
true
ae2e58b223299cd12fb439ff2c2785ca914903a3
Ruby
lsortnj/TechJob_crawler
/crawler.rb
UTF-8
1,896
2.8125
3
[]
no_license
require 'nokogiri' require 'json' require 'open-uri' host ="https://www.ptt.cc" doc = String data, link, post_id, articles_of_page= [] doc_article, title, content_text = String # next_page = html[2]['href']#下頁 # previous_page = html[1]['href']#上頁 count = Integer def parse_content(url) begin host ="https...
true
89c820e60127b6b4ee76f290536bd04e79d90a53
Ruby
danryan/adept
/lib/adept/forbidden.rb
UTF-8
326
2.828125
3
[]
no_license
module Adept class Forbidden < StandardError attr_reader :object, :action, :subject def initialize(object, action, subject) @object = object @action = action @subject = subject end def message "#{@object} is not authorized to #{@action} this resource: #{@subject}" end e...
true
c6f447c1c39050be290e1c5367ce4f93a715980d
Ruby
forrestaustin/cstore
/countCA_cstore.rb
UTF-8
2,092
2.734375
3
[]
no_license
require 'redis' require 'cstore_client' require 'hiredis' require 'optparse' options = {batch_size: 10} optparse = OptionParser.new do |opts| opts.banner = "Usage: ruby countCA_cstore.rb [options]" opts.on("--batch-size SIZE", Integer, "Batch size to sample from each shard. Default: #{options[:sample_size]}") do |...
true
92268585a9eb54a11ecf76cf5f21a8b0ff0ad719
Ruby
kemil/SearchSite
/app/models/marina.rb
UTF-8
1,460
2.671875
3
[]
no_license
class Marina < ActiveRecord::Base has_many :supplier_marinas belongs_to :country has_and_belongs_to_many :regions ### # Find marina names that matches the given term # # @param [String] term ### def self.find_names(term, limit=10) result = [] # first try prefix only match q = Marina.sele...
true
ad17d97255ea49e61f1de2439b47c3fe386bad44
Ruby
bitcababy/rolemaster
/spec/rolemaster/role_spec.rb
UTF-8
1,497
2.890625
3
[ "MIT" ]
permissive
require 'spec_helper' module RoleMaster describe Role do describe '#initialize' do subject { RoleMaster::Role.new('foo') } specify { subject.name.should eql('foo') } specify { subject.default_permission.should eql(:deny) } it { should be_frozen } end describe '#may_by_default?' do it "returns ...
true
09b61e2a5a1320a2fdf994855039bf477c6bd135
Ruby
hguerra/minesweeper
/lib/engine/board_state.rb
UTF-8
812
2.984375
3
[ "MIT" ]
permissive
module Engine class BoardState def initialize(board, **options) Engine::Validate.type 'board', Board, board @board = board @options = options end def get state = Array.new(@board.height) { Array.new(@board.width) } @board.each do |cell| state[cell.y - 1][cell.x - 1]...
true
d0117769483af734109821d9ef4d2217cebece62
Ruby
Jnorman2123/dynamic-orm-inheritance-online-web-ft-100719
/bin/run
UTF-8
550
2.640625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#!/usr/bin/env ruby require 'sqlite3' require_relative "../lib/interactive_record.rb" require_relative "../lib/song.rb" require_relative "../config/environment.rb" song = Song.new(name: "Hello", album: "25") puts "song name: " + song.name puts "song album: " + song.album song.save puts Song.find_by_name("Hello") so...
true
e04b42e30b754265fe8e0710b9b9231d345a4105
Ruby
johnpinker/exercism
/ruby/acronym/acronym.rb
UTF-8
105
2.75
3
[]
no_license
class Acronym def self.abbreviate(fullString) fullString.scan(/\b\w/).join.upcase end end
true
0504f0011e072cc5a61af59aca713955e79df50c
Ruby
paragliderfromsamara/visota_paraclub
/config/initializers/string_functions.rb
UTF-8
953
3.71875
4
[]
no_license
class String def ru_upper ['А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','М','Н','О','П','Р','С','Т','У','Ф','Х','Ц','Ч','Ш','Щ','Ъ','Ы','Ь','Э','Ю','Я'] end def ru_down ['а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я'...
true
7314540ba2bbe86c9aa996df059ea5366ecc50e7
Ruby
jsears4585/project-euler-multiples-3-5-web-051517
/lib/multiples.rb
UTF-8
225
3.265625
3
[]
no_license
# Enter your procedural solution here! def collect_multiples limit mult = (1...limit).select {|num| num % 5 == 0 || num % 3 == 0 } end def sum_multiples limit mult_ary = collect_multiples limit mult_ary.inject(:+) end
true
d56640364de3c123601c5f6bc643e5c589718470
Ruby
thebravoman/software_engineering_2015
/c06_json_and_xml/a/json.rb
UTF-8
400
2.96875
3
[]
no_license
require 'json' require 'pp' require 'net/http' city = 'Sofia' url = 'http://api.openweathermap.org/data/2.5/weather' query = "q=#{city}&appid=bd82977b86bf27fb59a04b61b657fb6f" uri = URI("#{url}?#{query}") forecast = Net::HTTP.get(uri) ruby_hash = JSON.parse(forecast, symbolize_names: true) weat...
true
dd4cae5191651ac3d04abd22482e407c734c41f6
Ruby
MatheusRich/kintama
/lib/kintama/context.rb
UTF-8
7,920
2.546875
3
[]
no_license
module Kintama module Context def setup (setup_blocks + after_setup_blocks).each do |block| instance_eval(&block) end end def teardown blocks = teardown_blocks blocks.each do |block| instance_eval(&block) end end def setup_blocks context = self...
true
0e3b0c0cac0311942694f7cb25c4434340301488
Ruby
shokai/tmp_cache
/test/test_mixin_instance.rb
UTF-8
931
2.546875
3
[ "MIT" ]
permissive
require File.expand_path 'test_helper.rb', File.dirname(__FILE__) class TestMixinInstance < MiniTest::Test class MyCache include TmpCache::Prototype def size keys.size end end def setup @tmp_cache = MyCache.new @tmp_cache.set('name', 'shokai', 2) end def test_instance_method ...
true
22cc11dcfb2c9893ae701ded3ee94c49e07b4f45
Ruby
francoiscabrol/francoiscabrol.github.source
/_plugins/carousel.rb
UTF-8
1,857
2.8125
3
[]
no_license
# Example of use in a template: # {% carousel localism_3.png | The mouse replacement || localism_2.png | The localism calibration window %} module Jekyll class Carousel < Liquid::Tag def initialize(name, params, tokens) super @params = split_params (params) end def lookup(context, name) ...
true
56e4255694dee69c2d58791e2d5c10f0d5f911fa
Ruby
Allaeddineattia/currency-data-junior
/app/services/transaction.rb
UTF-8
1,426
2.859375
3
[]
no_license
module TransactionService require_relative '../models/model.rb' require_relative "./converter.rb" Transaction.auto_upgrade! def createTransaction (sourceCurrence, sourceValue, destinationCurrence, destinationValue) @newTransaction = Transaction.new() @newTransaction.date = Time.now ...
true
2635a3db9014c7e73a39ea3d1c3b65438c292fff
Ruby
kojix2/ruby-htslib
/test/bam/cigar_test.rb
UTF-8
1,513
2.75
3
[ "MIT" ]
permissive
# frozen_string_literal: true require_relative "../test_helper" class BamCigarTest < Minitest::Test def setup @bam1 = HTS::Bam.new(Fixtures["poo.sort.bam"]) @cgr1 = @bam1.first.cigar @bam2 = HTS::Bam.new(File.expand_path("../../htslib/test/colons.bam", __dir__)) @cgr2 = @bam2.first.cigar @cgr3 =...
true
6e5fbb04763dafe4a1cc0d94ebae753e3585543c
Ruby
robin/rack-streaming-proxy
/dev/streamer.ru
UTF-8
1,041
2.609375
3
[ "MIT" ]
permissive
class Streamer include Rack::Utils def call(env) req = Rack::Request.new(env) headers = {"Content-Type" => "text/plain"} @chunked = req.path.start_with?("/chunked") if count = req.path.match(/(\d+)$/) count = count[0].to_i else count = 100 end @strings = count.times.collec...
true
3801b541f2ca33c8ba2c79ebe709c302f0ab6e32
Ruby
webco/tuiter
/lib/tuiter/methods/block.rb
UTF-8
955
2.84375
3
[ "MIT" ]
permissive
# Block Methods # [X] block_create # [X] block_destroy # [ ] block_exists # [ ] block_blocking # [ ] block_ids module Tuiter module BlockMethods def block_create(id) log("block_create() blocking: #{id}") res = @request_handler.post("/blocks/create/#{id}.json") case res when Net::...
true
5ece86794f9cc11d33d9f7fdd2edc442a2765a1f
Ruby
chrisbloom7/parslet-v-treetop
/bin/benchmark
UTF-8
2,351
3
3
[]
no_license
#!/usr/bin/env ruby require 'benchmark' require 'benchmark/ips' require_relative '../lib/parslet_test/parser' require_relative '../lib/treetop_test/parser' queries = { small: "A", medium: "AA \"BB CC\"", large: "AAA \"BBB CCC\" DDD:EEE", xlarge: "AAAA \"BBBB CCCC\" DDDD:EEEE FFFF:\"GGGG\" HHHH", xxlarge: "...
true
14645a2c6801d6b9c6ed076385a1100717b8624b
Ruby
Patrick-Mondala/W6D4
/Chess/slideable.rb
UTF-8
1,550
3.078125
3
[]
no_license
module Slideable def moves possible_moves = [] self.move_dirs.each do |(row_dir, col_dir)| possible_moves += grow_unblocked_moves_in_dir(row_dir, col_dir) end possible_moves end private DIAGS = [ [-1, 1], [-1, -1], [1, 1], ...
true
76b88796211f033643f7e0cf98ad930d7b679e44
Ruby
jlaw90/rsynth
/lib/rsynth/phase_shifter.rb
UTF-8
405
2.828125
3
[]
no_license
module RSynth class PhaseShifter include RSynth::Functions attr_accessor :source, :offset def initialize(source, offset=nil) offset = Proc.new {|time| yield time} if block_given? raise 'No offset or block defined' if offset.nil? @source = source @offset = offset end def v...
true