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
7ff84587b1c66f491e1cf3f4b1405a76be1bc52e
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/word-count/0387763ad7e54b64acdab88c09a2e524.rb
UTF-8
197
2.921875
3
[]
no_license
class Phrase < Struct.new :phrase def word_count phrase.scan(WORDS).group_by(&:downcase). map(&COUNT).reduce :merge end WORDS = /\w+/ COUNT = -> (( k, v )) {{ k => v.count }} end
true
1621975c6232e16fae21b41effe0e800ade15fe1
Ruby
mhahmadi/numbeers
/app/helpers/transactions_helper.rb
UTF-8
1,479
2.65625
3
[]
no_license
module TransactionsHelper def self.first_pour_of_day() Transaction.where("created_at >= ?", Time.zone.now.beginning_of_day).first end def total_pours() Transaction.count() end def most_pours_by_a_user() pours = Transaction.all() if pours.blank? "No Pours Yet!?" else h = p...
true
f734da000dc1b92dae75657db947a88dc16e2fc6
Ruby
google-code/asproject
/rb/lib/tasks/flash_log.rb
UTF-8
1,093
2.75
3
[ "MIT" ]
permissive
module AsProject class FlashLog attr_accessor :version def initialize @path_finder = PathFinder.new verify_config_file end def get_file return @path_finder.flash_player_log end private def verify_config_file config = @path_finder.flash_player...
true
189a044d85c3be3490333539b7d844050d982dc9
Ruby
ruby-llvm/ruby-llvm
/test/memory_access_test.rb
UTF-8
1,494
2.625
3
[ "BSD-3-Clause", "Ruby", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
permissive
# frozen_string_literal: true require "test_helper" class MemoryAccessTestCase < Minitest::Test def test_simple_memory_access assert_equal 1 + 2, simple_memory_access_function(1, 2).to_i end def test_array_memory_access assert_equal 3 + 4, array_memory_access_function(3, 4).to_i end private de...
true
5f55a229284611b5347f21f913e6687a3a1bf4d9
Ruby
cielavenir/procon
/hackerrank/sherlock-and-pairs.rb
UTF-8
129
2.609375
3
[ "0BSD" ]
permissive
#!/usr/bin/ruby gets.to_i.times{ gets p gets.split.map(&:to_i).sort.chunk{|e|e}.reduce(0){|s,(k,v)| n=v.size s+n*(n-1) } }
true
8005ea4602f73ae9c5faca783c96875a1c1abb27
Ruby
beckybair/ruby_challenges
/scrape_recipe.rb
UTF-8
716
3.625
4
[]
no_license
# Scrape a Recipe #Start your script by requiring the nokogiri gem and also one of its dependencies: require 'nokogiri' require 'open-uri' #Next, get the HTML for the recipe page and assign it to a variable: doc = Nokogiri::HTML(open("http://www.marthastewart.com/312598/brick-pressed-sandwich")) #Search the HTML for...
true
fc695bc83d41373996d64898a22fbfb6c9577855
Ruby
akshay-vishnoi/Advance-Ruby
/e-3/e-3.rb
UTF-8
261
3.421875
3
[]
no_license
#main puts "\nEnter name of the function" func_name = gets.chomp puts "\nEnter 1-line statement for function" func_statement = gets.chomp instance_eval "def #{func_name} #{func_statement} end" puts "\nCalling method: #{func_name}()\n" instance_eval func_name
true
3cde0f2fd527f6e70d517ce9ec7546f8fc7f858e
Ruby
nicoasp/TOP---Ruby-oop-project
/project2/algorythm.rb
UTF-8
4,087
3.4375
3
[]
no_license
=begin Create a set S of the 1296 possible codes (1111, 1112... 6665, 6666) Use check_guess method on code [1, 1, 2, 2] and obtain hint Process 1 Run check_guess method with [1, 1, 2, 2] using every other possible code as solution. Each code that doesn't produce the same hint for [1, 1, 2, 2] as the solution code,...
true
9e33f16312ffd9c785bea6de7a89a2c34bb9de77
Ruby
yokoyamaJP/rubytest
/iterator/main2.rb
UTF-8
514
3.234375
3
[]
no_license
require "./portfolio.rb" require "./account.rb" portfolio = Portfolio.new portfolio.add_account(Account.new("account1", 1000)) portfolio.add_account(Account.new("account2", 2000)) portfolio.add_account(Account.new("account3", 3000)) portfolio.add_account(Account.new("account4", 4000)) portfolio.add_account(Account.new...
true
a029591ec6b06221d9c24713a849655c87d17d3c
Ruby
amundskm/chess
/lib/chess.rb
UTF-8
13,904
3.78125
4
[]
no_license
class Piece # Create a chess peices with a name, # of moves, and color attr_accessor :num_moves, :white_pieces, :black_pieces attr_reader :name, :color, :unicode @@white_pieces = [] @@black_pieces = [] def initialize(name, color, unicode) @name = name @color = color @nu...
true
479f54bf86c095fd1d74fe9f9ca3925258d05f40
Ruby
PD2015/launch_school
/oop/lesson_5/twenty_one2.rb
UTF-8
3,989
3.8125
4
[]
no_license
# ************************** CARD ************************************ class Card attr_reader :value def initialize(value) @value = value end end # ************************** DECK ************************************ class Deck CARD_VALUES = (%w(Ace Jack Queen King ) + (1..10).to_a) * 4 attr_reader :cards...
true
83e0cda68e4c815fed6cd5380d028d4d7091f8af
Ruby
chris-groves/algorithms
/Own-Algorithms/Most-Frequent-Words/spec/most_frequent_words_spec.rb
UTF-8
1,397
3.109375
3
[]
no_license
require 'most_frequent_words' describe Words do describe 'find most_frequent_words' do it 'returns "cat" for an array with one word' do words = Words.new(["cat"]) expect(words.most_frequent_words(["cat"])).to eq ["cat"] end it 'returns "dog" for an array with three words' do words = Wo...
true
db9f4120e5b6dc87319ff2ac54f25104115964ef
Ruby
levimllr/sinatra-basic-forms-lab-teacher-onboarding
/models/puppy.rb
UTF-8
266
2.921875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Puppy attr_accessor :name, :breed, :months_old @@all = [] def self.all @@all end def initialize(puppy_hash) @name = puppy_hash[:name] @breed = puppy_hash[:breed] @months_old = puppy_hash[:months_old] @@all << self end end
true
7c5289c6c1d2cd0c409406bccecbb9079a21cc0b
Ruby
olook/chaordic-packr
/lib/chaordic-packr/variant.rb
UTF-8
900
2.8125
3
[]
no_license
require "chaordic-packr/packable_with_info" require 'oj' module Chaordic module Packr # Product variant class Variant attr_accessor :name, :sku, :price, :old_price # @param [String] name Product name. # @param [String] sku Product storage identification. # @param [Numeric] price Prod...
true
c8cfe59f270126546ec5af6b0d8aaedbb31f4353
Ruby
emaadmanzoor/arguman-scraper
/lib/scraper/scraper.rb
UTF-8
2,078
2.5625
3
[ "MIT" ]
permissive
module Scraper class Scraper def self.get_debates(from, upto, except, verbose, matcher, dry) url = "http://arguman.org/api/v1/arguments/?page=#{from}" loop do puts "\n#{url}" response = HTTParty.get(url) json = response.parsed_response json["results"].each do |res| ...
true
ee03005927d8ee36ff174237559b472a064e8046
Ruby
utarsuno/ruuuby
/lib/ruuuby/math/space/discrete/nucleotide_space.rb
UTF-8
1,809
2.6875
3
[ "MIT" ]
permissive
# encoding: UTF-8 # mathematics related code module ::Math # math related code that can be categorized under +Space+ module Space class NucleotideSpace < ::Math::Space::TypesSpaceⓣ¹ def initialize @space_type = 'types' @symbol = :🧬 @num_dimensions = 1 end ...
true
66e90a8744fc1ef566ea6efb3ad0e352cf2a1ceb
Ruby
devops-israel/tessera-dsl-plugin
/lib/tessera-api.rb
UTF-8
3,348
2.515625
3
[]
no_license
#!/usr/bin/env ruby require 'net/http' require 'json' require 'time' class Hash def diff(other) (self.keys + other.keys).uniq.inject({}) do |memo, key| unless self[key] == other[key] if self[key].kind_of?(Hash) && other[key].kind_of?(Hash) memo[key] = self[key].diff(other[key]) ...
true
cd9eab7ec9f2d6e704fa2bdafd9f8ea0fe5a0222
Ruby
Mattlk13/maglev
/src/test/github338.rb
UTF-8
1,172
3.46875
3
[]
no_license
require 'socket' server = TCPServer.new "127.0.0.1", 2000 # Server bind to port 2000 output = [] def read_socket_message(socket, chunk_size = 2) buffer = "" while ! buffer.end_with?("\n") IO.select([socket]) buffer << socket.read_nonblock(chunk_size) end buffer end server_thread = Thread.new do loo...
true
1625332f3a6c496e2d13b88d2e904db12433ffb7
Ruby
justonemorecommit/puppet
/lib/puppet/functions/then.rb
UTF-8
2,620
3.359375
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
# Calls a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) # with the given argument unless the argument is `undef`. # Returns `undef` if the argument is `undef`, and otherwise the result of giving the # argument to the lambda. # # This is useful to process a sequence of operations where an intermediat...
true
7fbadcbe814cad13d46dddd997bb7dd689a61905
Ruby
drbarq/MILLENNIAL-TRANSLATION-SERVICE
/app/getdata.rb
UTF-8
636
2.609375
3
[]
no_license
require "pry" require_all "./app" class GetData def self.get_word_definition(word) url = "https://mashape-community-urban-dictionary.p.rapidapi.com/define?term=" #basic URI for the API endpoint @@data = RestClient::Request.execute(method: :get, url: url+word, #api request for the data he...
true
e31ffff84e554811d9f8363e1140ba5ec2574e03
Ruby
DavidPenafiel/ruby_noob2017
/12 lecturareves.rb
UTF-8
604
3.1875
3
[]
no_license
puts "LECTURA NORMAL\n" File.open('12hola').readlines.each do |linea| puts linea end puts "\nINVERTIR DIRECTO EN RECORRIDO" File.open('12hola').readlines.each do |linea| puts linea.reverse end puts "\nUSANDO ARREGLOS PARA INVERTIR EL ORDEN DE LAS LÍNEAS" new_array = [] File.open('12hola').readlines.each do |linea| ...
true
58938f8ea61754cdb7b1c3774628c0c269bde483
Ruby
Nepsaco/ruby-enumerables-hash-practice-green-grocer-lab-denver-web-100719
/grocer.rb
UTF-8
1,443
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def consolidate_cart(cart) final_cart = {} cart.each do |element| element_name = element.keys[0] element_values = element.values[0] if final_cart.has_key?(element_name) final_cart[element_name][:count] += 1 else final_cart[element_name] = { coun...
true
479f2e4d706ca4a7478393bac9aed376ec54eac4
Ruby
DavidAlexSiler/badges-and-schedules-atlanta-web-060319
/conference_badges.rb
UTF-8
517
3.90625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def badge_maker(name) return "Hello, my name is #{name}." end def batch_badge_creator(array) badges = [] array.each do |name| badges << badge_maker(name) end return badges end def assign_rooms(array) new_arr = [] room = 1 array.each do |name| new_arr << "Hello, #{name}! You'll be assigned to ...
true
025032374850332e230086aab956ca6a4141db14
Ruby
adammccormack/bank-tech-test
/lib/account.rb
UTF-8
763
3.546875
4
[]
no_license
class Account DEFAULT_BALANCE = 0 attr_reader :balance, :transactions def initialize @balance = DEFAULT_BALANCE @transactions = [] end def deposit(amount) @balance += amount transactions.push({date: Time.now.strftime("%d/%m/%Y"), amount: amount, balance: balance }...
true
c95be306e1354014db619605bdf21527b01713af
Ruby
janice-wong/vitals-platform-code-test
/update_quality.rb
UTF-8
1,435
3.15625
3
[]
no_license
require 'award' class Item attr_reader :quality, :expires_in def initialize(quality, expires_in) @quality, @expires_in = quality, expires_in end def update_award_quality end end class BlueFirst < Item def update_award_quality @quality += 1 @quality += 1 if @expires_in <= 0 @quality = 50 ...
true
d39cdc61ab60777b5988a014e3cd033a043e4334
Ruby
andytinycat/sensu-apihelper
/lib/sensu-apihelper/client.rb
UTF-8
2,116
2.78125
3
[ "MIT" ]
permissive
require 'rest_client' require 'net/http' require 'json' module Sensu module Apihelper # Representation of a Sensu client. class Client attr_accessor :name, :ip, :subscriptions, :last_check_in, :check_statuses # Return all Sensu clients. def self.get_all json = JSON.parse Net...
true
a888933c76e128e82f2c9aea5be9ad493f79b00f
Ruby
arissetyawan-ruby/ewallet
/app/helpers/application_helper.rb
UTF-8
251
2.65625
3
[]
no_license
module ApplicationHelper def you(a, b) "(you)" if a==b end def error_messages_for(obj) res= "<ul>" obj.errors.each do |k, v| res+= "<li>" + k.to_s.humanize + " " + v.humanize.downcase + "</li>" end res += "</ul>" raw(res) end end
true
fc626c1bed8b9b5a16c03ee58bbe0d2ca1cdaf56
Ruby
maxim/sogger
/lib/sogger/question.rb
UTF-8
810
2.90625
3
[ "MIT" ]
permissive
module Sogger class Question include Comparable attr_accessor :attributes def initialize(attributes = {}) @attributes = attributes end def self.from_xml(xml_element) attributes = { :title => xml_element.css('title').text, :url => xml_element.css('id').t...
true
18cbdf9ae370bfcf6471eb9c8e4b7d603ad7839f
Ruby
ninoseki/codewars
/5kyu/calculating.rb
UTF-8
702
3.4375
3
[]
no_license
# http://www.codewars.com/kata/calculating-with-functions/train/ruby require 'minitest/spec' require 'minitest/autorun' describe 'static example calculations' do it 'test' do assert_equal seven(times(five())), 35 assert_equal four(plus(nine())), 13 assert_equal eight(minus(three())), 5 assert_equal s...
true
a34d02ac88765379dee0e6af71f00d9fa0a90a35
Ruby
Pavel-Zyryanov/Lessons
/Lesson 9/passenger_car.rb
UTF-8
242
2.671875
3
[]
no_license
# frozen_string_literal: true class PassengerCar < Car validate :id, :presence validate :id, :format, CAR_ID_FORMAT def initialize(id, place) super(id, place) @type = 'Passenger' end def take_place super(1) end end
true
fcf463c19f3e2f67558de1e5cf27c4762c5f44b2
Ruby
yokotaso/cybozu-launch-menu
/cybozu/launch/menu/service/Client.rb
UTF-8
472
2.546875
3
[]
no_license
require 'nokogiri' require 'open-uri' require 'kconv' class Client SAGANO_URL="http://www.bento-sagano.jp/menu/higawari/index.html" TAMAGOYA_URL="http://www.tamagoya.co.jp/menu.html" def initialize(url) @url = url end def self.sagano() return Client.new(self::SAGANO_URL) end def self.tamagoya...
true
bdbdeaec94d0f238fd8aa6efdb335325aff8a0ff
Ruby
Jeff-Shap/Projects
/VotingSim/working/voting_4.rb
UTF-8
4,470
2.96875
3
[]
no_license
# $politicians = {"jeb" => "rep", "hil" => "dem"} # $voters = {"voter1" => "soc", "voter2" => "tea", "voter3" => "lib", "voter4" => "con", "voter5" => "nuet"} module Vote def speech_roll speech_num = [0,1].sample if speech_num == 0 $speech = $politician_array[0] else $speech = $politician_array[1] ...
true
453eb4a862a73d1aff600520cdabde9223d2a928
Ruby
MagicKey23/Hex_Binary_Conversion
/Binary.rb
UTF-8
2,561
3.5625
4
[]
no_license
class Binary # Divide the number by 2. # Get the integer quotient for the next iteration. # Get the remainder for the binary digit. # Repeat the steps until the quotient is equal to 0. BINARY = {0=>0, 1=>1} def value_of_binary(n) return 2**n end def isNegative?(n) if n < 0 ...
true
9f97f5b8aacdafabc7a7d4f649e0405ee2b30db0
Ruby
Hamish-h/codeclan_pub
/specs/customer_spec.rb
UTF-8
959
3
3
[]
no_license
require("minitest/autorun") require("minitest/rg") require_relative("../pub.rb") require_relative("../customer.rb") require_relative("../drink") class CustomerTest < MiniTest::Test def setup @customer = Customer.new("Hamish", 0) @pub = Pub.new("Joe's Drinking Hole", 100) @drink = Drink.new("Joe's Beer",...
true
c659ea7d02f6e67a07fd386d8783e1269d6d4d97
Ruby
aungaungNMK/ruby_learning_for_gold
/chapter 9 Ruby Platform/arrays.rb
UTF-8
483
3.640625
4
[]
no_license
[1,2,3] #Basic array literal [] #empty array [] #arrays are mutable :but this empty array is different. %w[a b c] #['a','b','c'] Array[1,2,3] empty = Array.new nils = Array.new(3) #[nil,nil,nil] copy = Array.new(nils) zoros = Array.new[4,0] #[0,0,0,0] count = Array.new(3){|i| i + 1} #[1,2,3] print a = Array...
true
3ef4545d8dd504dd49aa5e677104b9dce3049b00
Ruby
akxs14/jruby_big_decimal
/lib/big_decimal.rb
UTF-8
754
3.4375
3
[ "MIT" ]
permissive
# encoding: utf-8 require 'java' java_import "java.math.BigDecimal" class BigDecimal def +(y) self.add(y) end def -(y) self.subtract(y) end def *(y) self.multiply(y) end def /(y) self.divide(y) end def **(n) n.class == java.math.BigDecimal ? int_n = n.toString.to_i : int_n =...
true
fcc31d8015a214c8bdf4ab0c1f4674ec32e07226
Ruby
nychinn/article-notes
/online-course/odinproject/ruby/exercise/calc.rb
UTF-8
8,843
3.875
4
[]
no_license
# puts "Hours in one year: #{(24 * 356)}" # puts "Minutes in a decade: #{ ((60 * 24) * 356 * 10) }" # puts "Seconds old: #{ ((((28 * 60) * 60) * 24) * 365) } +" # puts "If I am 1298 million seconds old, how old am I? #{ (((1298000000 / 365) / 24) / 60) / 60 }" # puts 'blink ' * 4 # puts '15'.to_f # puts '99.999'.to_...
true
c549282e41c5ff94437bd151b49bd49e6533b028
Ruby
vifino/Numatron
/modules/utility/ctcp.rb
UTF-8
1,125
2.65625
3
[ "EFL-2.0" ]
permissive
# CTCP replies and... things. # Made by vifino require 'timeout' def ctcpping(usr) @bot.ctcp(usr,"PING")#+Time.now.to_i.to_s+" 12345") isResponse=false t1=Time.now ret="" begin Timeout::timeout(5) do while true do data= @bot.msgtype(@bot.lastline) type = data[0] nick = data[1] chan = data[2] ...
true
b7ddf170bdcf8ec1c20d64b4c2e0018b1db880a4
Ruby
isabeldiazmi/Sopa-de-Letras
/classBoard.rb
UTF-8
1,914
3.546875
4
[]
no_license
class Board def initialize(arr, str, fil, col) @arr = arr @str = str @fil = fil @col = col @mat = complete_board! end def to_s matriz = @str.each_slice(@fil).to_a end def complete_board! arr = @str.split("") matriz = [] #cambia las x a letras aleatorias arr.each...
true
e7598ea932cfdcdd605360343a4d4942e2615550
Ruby
skilletfan59/learnruby
/09_timer/timer.rb
UTF-8
609
3.71875
4
[]
no_license
class Timer attr_accessor :time_string, :seconds def initialize @seconds = 0 @number = nil @time_string = "00:00:00" end def seconds=(seconds) @seconds = seconds converter(@seconds) end def converter(seconds) @seconds = seconds.to_i hr = @seconds / 3600 min = (@seconds % 3600) / 60 sec = (@sec...
true
61028067f0f5310485111847f068a9a12a27e43c
Ruby
beesasoh/ruby-alogarithms
/min_jumps.rb
UTF-8
481
3.453125
3
[]
no_license
@memo = {} def min_jumps(arr) len = arr.length return @memo[len] if @memo.key? len return 0 if len < 2 return 1 if arr[0] >= (len + 1) return Float::INFINITY if arr[0].zero? options = [] i = 0 while i < arr[0] options << min_jumps(arr.drop(i + 1)) i += 1 end results = 1 + options.min @...
true
01f1d9292e2fa3ab4cd8f7341d7d12342b205b34
Ruby
kylewatsonstash/scratch
/homework2.rb
UTF-8
269
4.15625
4
[]
no_license
#For all the numbers between 0 and 1000 check to see if #the number is even and print out "yay" if it is, or "boo" if it isn't start = 0 maximum = 10 while start < (maximum + 1) if start.even? puts "yay" elsif start.odd? puts "boo" end start += 1 end
true
0f4ddc74e5b69b4dada327c581c48f9e8704bc2c
Ruby
dmyronuk/ar-exercises
/exercises/exercise_1.rb
UTF-8
481
3.140625
3
[]
no_license
require_relative '../setup' puts "Exercise 1" puts "----------" # Your code goes below here ... s1 = Store.new s1.name = "Burnaby" s1.annual_revenue = 300_000 s1.mens_apparel = true s1.womens_apparel = true s1.save s2 = Store.new({ name: "Richmond", annual_revenue: 1_260_000, mens_apparel: false, womens_appa...
true
c0795d7dc6ff70d35ca678ddad85e187529ca99d
Ruby
contentful/drupal-exporter.rb
/lib/drupal/vocabulary.rb
UTF-8
1,119
2.53125
3
[ "MIT" ]
permissive
module Contentful module Exporter module Drupal class Vocabulary attr_reader :exporter, :config def initialize(exporter, config) @exporter, @config = exporter, config end def save_vocabularies_as_json exporter.create_directory("#{config.entries_dir}/voc...
true
0f179f92bb7b3d97814737ced46e62abe3025c11
Ruby
rouzbeht/AWE
/hangman.rb
UTF-8
287
3.0625
3
[]
no_license
# Rouzbeh T.Sharifabadi word="bicycle"; wrong="" puts output="-------" 7.times do input=gets for i in 0..word.length-1 if input==word[i].chr+"\n" output[i]=word[i].chr check=true end end if not check wrong=wrong+input[0].chr end puts output+" "+"( "+wrong+" )" end
true
3573e316d1c8e0797c2e2af6c8c7176421207d69
Ruby
mess110/ki
/lib/ki/orm.rb
UTF-8
6,969
2.671875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'singleton' module Ki module Orm #:nodoc: # This singleton class establishes the database connection and CRUD # operations. # # == Connecting # # Db.instance.establish_connection # # == Queries # # db = Db.instance # db.find 'us...
true
ebdf34ccdfa51f94462106eb9358e497f9e8cdaa
Ruby
midorirestani/validacao-verificacao-software
/Ex7 - FIRST test principles/lib/boleto.rb
UTF-8
1,235
3.28125
3
[]
no_license
require 'active_support/all' require 'cpf_utils' class Boleto attr_accessor :value, :cpf, :name, :expiration_date def initialize(value, name, cpf) @value = value @name = assign_name(name) @cpf = validate_ass...
true
10db568210b69214e446db828c396d853d68596f
Ruby
nico24687/reunion
/test/activity_test.rb
UTF-8
1,502
3.0625
3
[]
no_license
require 'minitest' require 'minitest/autorun' require 'minitest/pride' require './lib/activity' require 'pry' class ActivityTest < Minitest::Test def test_activity_has_attributes activity = Activity.new("hiking") assert_equal "hiking", activity.name end def test_activity_has_no_participants_by_defaul...
true
2531923a08dbb4afe926479344d8aaa023b36882
Ruby
tiyd-ror-2016-06/sinatra-todos
/script.rb
UTF-8
1,238
3.171875
3
[]
no_license
require 'httparty' require 'pry' class MyApi attr_reader :headers, :url def initialize url @url = url end def login_as username @headers = { "Authorization" => username } end def list_items make_request :get, "/list" end def add_new_item title make_request :post, "/list", body: { ti...
true
a3bf9a7ea56448dec8c97776f3e96e5f6688ef09
Ruby
Mo7amed178/amex-week_07-day_03-Ruby_Classes
/Answer.rb
UTF-8
455
3.765625
4
[]
no_license
class Masameer attr_reader :location attr_accessor :name def initialize (name, location) @name = name @location = location end def driving_speed puts "180kph" end def destination puts "In #{location}" end def speak puts "ummmmm" end en...
true
a436a4db83e7654386c481d5671331d71f7ee214
Ruby
Mattackai/RB_101
/Exercises/small_problems_RB101-RB109/easy5_7.rb
UTF-8
370
3.375
3
[]
no_license
def word_sizes(string) result = Hash.new(0) string = string.gsub(/[^a-z ]/i, '').squeeze(' ') array = string.split array.each do |word| result[word.size] += 1 end result end print word_sizes('Four score and seven.') print word_sizes('Hey diddle diddle, the cat and the fiddle!') print wo...
true
0607e2b33ef2e3f2fba37530f7c2a69aa76c0ea0
Ruby
masterraf21/GoEat
/lib/GoEat/peta.rb
UTF-8
2,878
3.328125
3
[ "MIT" ]
permissive
module GoEat class Randomize def self.random_coordinate(obj, a, b) # obj is an object that has coordinate attribute. a and b is the interval obj.coordinate.x = rand(a..b) obj.coordinate.y = rand(a..b) end end class Travel def self.distance(loc_a, loc_b) # loc_a and loc_b is...
true
4cd156bafe0fcb033650b3071d4f9aa74bb15bee
Ruby
hervit0/eclair-ruby
/sudoku/model/sudoku.rb
UTF-8
4,758
2.9375
3
[]
no_license
#Sudoku solver input_example = [ ["x","x","x","x",7,"x","x","x","x"], ["x","x","x","x","x","x",9,"x",1], ["x","x",8,1,"x","x",2,4,3], ["x","x",9,"x","x",5,"x",2,"x"], [2,"x","x","x","x",7,"x","x",8], ["x","x","x",6,4,"x","x",5,"x"], ["x",2,4,"x","x","x","x","x","x"], ["x","x",1,7,"x",4,"x","x",5], ["x...
true
f55aad6c4f557a13c451e1ddd7ac09f862875fdc
Ruby
waltershub/W1D5-walter-shub-Chris-Hakos
/Knights's_Travails.rb
UTF-8
550
2.953125
3
[]
no_license
require 'byebug' require_relative '00_tree_node.rb' class KnightPasthFinder attr_reader :start_pos attr_accessor :postion :root_node def initialize(postion = []) @start_pos = postion @visted_postions = [start_pos] build_move_tree end def new_move_postion(pos) end def build_move_tree s...
true
ae355c1f114881aecb814b4eb5d0c1dada8c1ebd
Ruby
jaw6/fastly_nsq
/lib/fastly_nsq/listener.rb
UTF-8
1,328
2.734375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'fastly_nsq/message' module FastlyNsq class Listener def self.listen_to(**args) new(**args).go end def initialize(topic:, processor:, channel: nil, consumer: nil, **options) @topic = topic @processor = processor @consumer = consumer || FastlyNsq::Consumer.ne...
true
4892d0b0f0859eba18d65869f67c3f3c67d05247
Ruby
spectra-music/mutagen-ruby
/lib/mutagen/id3/id3data.rb
UTF-8
26,689
2.6875
3
[ "MIT" ]
permissive
require 'mutagen/metadata' require 'mutagen/util' module Mutagen module ID3 # A file with an ID3v2 tag. class ID3Data < Mutagen::Metadata include Mutagen::Util::DictProxy V24 = Gem::Version.new '2.4.0' V23 = Gem::Version.new '2.3.0' V22 = Gem::Version.new '2.2.0' ...
true
36329de59a9389c38469f75dd48e049183e5ff8b
Ruby
ejaypcanaria/intro_to_git
/hello_world.rb
UTF-8
135
3.390625
3
[]
no_license
def hello_world puts "Hello world from Ruby!" end def greet(salut, name) puts "#{salut}, #{name}!" end hello_world greet("Ejay")
true
ca42233ef12f2a946a1051e5e6c16e43d3ae37ea
Ruby
kartik1982/XirrusMgmtSys_API
/executor/report_status_formatter.rb
UTF-8
955
2.671875
3
[]
no_license
module EXECUTOR class ReportStatusFormatter RSpec::Core::Formatters.register self, :example_passed, :example_pending, :example_failed def initialize(out) @out = out end def example_finished(notification) example = notification.example # @out.puts "finishing up test: #{example.me...
true
aa177747836f0ef1ef391f6c27788e24078b54a5
Ruby
Promptus/trixer
/spec/trixer/slotter_spec.rb
UTF-8
19,969
2.703125
3
[ "MIT" ]
permissive
# frozen_string_literal: true include Trixer RSpec.describe Slotter do let(:slots) { (64..73).to_a } # 16:00 - 18:15 let(:limit) { nil } let(:slot_limit) { nil } let(:blocked_slots) { nil } let(:check_limits) { true } let(:matrix) { Slotter.new(slots: slots, places: places, links: links, limit: limit, slo...
true
b4f41dc181b2beb12ff463d814fd55da52a02e67
Ruby
Reltre/exercism-challenges
/ruby/word-count/word_count.rb
UTF-8
229
3.265625
3
[]
no_license
class Phrase def initialize(words) @phrase = words end def word_count phrase = @phrase.split(/(?!\')\W+/) phrase.each_with_object(Hash.new(0)) do |word, hash| hash[word.downcase] += 1 end end end
true
ac9d0c18fd3c155abc64a5275ba753891ab3c461
Ruby
zacck-zz/learning_ruby
/inputs.rb
UTF-8
540
4.0625
4
[]
no_license
#give a prompt to accept a number puts "please enter the first number" first_number = gets.chomp puts "please enter second number " #this accepts inputs from the keyboard second_number = gets.chomp #ruby inputs are always regarded as strings in order to do calculations on them we need to convert them to numbers fi...
true
d690c0ecae9c39e8d5cb7baf661c249b471598d3
Ruby
FKnottenbelt/Practicing_Ruby
/ruby_practice/reshuffle_int.rb
UTF-8
527
4
4
[]
no_license
# Given a number, return the highest number that could be # formed from the input number's digits. puts max_number(213) == 321 puts max_number(7389) == 9873 puts max_number(63792) == 97632 puts max_number(566797) == 977665 puts max_number(1000000) == 1000000 #################333 =begin I: int o: r...
true
d9b809712f407b17f3fd2f95ebb2007764c8f848
Ruby
thecodepixi/OneLineADay
/app/models/day.rb
UTF-8
684
2.609375
3
[ "MIT" ]
permissive
class Day < ApplicationRecord # join table between users and their journals, and users, their journals and their moods belongs_to :user belongs_to :mood belongs_to :journal validates :description, length: { maximum: 250, message: "Journal descriptions can only be 250 characters long." }, presence: true ...
true
672fcfd7d129b884d3216fb9515c70299b7744ea
Ruby
mongodb/mongo-ruby-driver
/lib/mongo/address/unix.rb
UTF-8
2,254
2.53125
3
[ "Apache-2.0" ]
permissive
# frozen_string_literal: true # rubocop:todo all # Copyright (C) 2014-2020 MongoDB Inc. # # Licensed under the Apache License, Version 2.0 (the 'License'); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
true
07192bde96d2d99d0461ae7885ab89091dfd61f2
Ruby
marzily/sales_engine
/test/item_test.rb
UTF-8
1,325
2.5625
3
[]
no_license
require_relative 'test_helper' class ItemTest < Minitest::Test attr_reader :item, :item_from_repo def setup data = { id: "1", name: "Test Item", created_at: "2012-03-27 14:54:00 UTC", updated_at: "2012-03-27 14:54:00 UTC", description:...
true
4fad0f028777ffe4a3461ea3b49d7a529e0fcc71
Ruby
nruth/fingar
/produce_pdf_graphs.rb
UTF-8
675
2.53125
3
[ "MIT", "LicenseRef-scancode-public-domain" ]
permissive
#!/usr/bin/env ruby -wKU raise ArgumentError unless sourcefilename = ARGV[0] raise ArgumentError unless runs = ARGV[1] raise ArgumentError unless dataname = ARGV[2] raise ArgumentError unless dir = ARGV[3] puts "Making Graphs with MATLAB" cmd = "plot_graphs('#{dir}', #{runs}, '#{dataname}', '#{sourcefilename}') exi...
true
6e20e3079ab848bd73b868a2fb5e456371261b98
Ruby
a6ftcruton/mastermind
/test/hi_scores_test.rb
UTF-8
509
2.59375
3
[]
no_license
gem 'minitest' require 'minitest/autorun' require 'minitest/pride' require_relative '../lib/hi_scores' class HiScoresTest < Minitest::Test def test_it_has_filename hiscores = HiScores.new('first-hi-scores.txt', 'a+') assert_equal hiscores.filename, 'first-hi-scores.txt' end def test_it_puts_text_into_fi...
true
ee2413b34e458bca66e364c371697d5ee129c462
Ruby
harley/weblish
/config/initializers/time_formats.rb
UTF-8
763
2.671875
3
[]
no_license
# Add commonly used time format here. Usage: time_object.to_s(:am_pm) or :short_name, or etc. -H my_formats = { am_pm: "%l:%M %p", am_pm_long: "%b %e %Y, %l:%M %p", am_pm_long_tz: "%b %e %Y, %l:%M %p %Z", am_pm_noyear: "%b %e, %l:%M %p", am_pm_long_no_comma: "%I:%M %p %b %d (%Y)", twelve_hour: "%I:%M", ju...
true
4e47e3fe94a59eb4e5e9badcde12514c9452423e
Ruby
annebea/Hadenn
/app/models/product.rb
UTF-8
1,085
2.953125
3
[]
no_license
class Product < ApplicationRecord has_many :product_lots has_many :order_lines has_many :orders, through: :order_lines #allows to find all orders for a given product has_one_attached :photo def total_remaining_quantity total_remaining_quantity = 0 product_lots.each do |product_lot| total_remain...
true
17d9f0bd23d5544ddbbb139aeb90f3f4f13970b9
Ruby
SydneyTestersBootcamp/sydneyTestersBootcamp
/01_TestingFramework/lib/carQuote.rb
UTF-8
588
2.921875
3
[ "Apache-2.0" ]
permissive
require 'quote' require 'carPremiumCalculator' class CarQuote < Quote attr_reader :year, :make, :premium @@makes = {"audi" => "Audi", "alfa" => "Alfa Romeo", "bmw" => "BMW", "lexus" => "Lexus", "toyota" => "Toyota", "vw" => "Volkswagen"} def initialize(age, email, state, make, gender, year) @age =...
true
bd957b29149d295b1152b382907a53ed1bf6304d
Ruby
Graciexia/w2-day1-homework-basics
/profile-info.rb
UTF-8
1,053
3.890625
4
[]
no_license
info_hash = {name: "Wei Xia", age: 32, username: "Graciexia", city: "Austin", country: "USA"} food_arr = ["sushi", "BBQ", "taco", "spicy fish", "pho"] def print_profile(info_hash,food_arr) puts "my name: #{info_hash[:name]}" puts "my age: #{info_hash[:age]}" puts "my user name: #{info_hash[:username]}" puts "m...
true
5f0da705eea2622dd31f2aee8d97172b46c5f961
Ruby
muffatruffa/RB130---Ruby-Foundations-More-Topics
/easy2/each_with_index.rb
UTF-8
770
4.25
4
[]
no_license
# Write a method called each_with_index that behaves similarly for Arrays. # It should take an Array as an argument, and a block. # It should yield each element and an index number to the block. # each_with_index should return a reference to the original Array. # def each_with_index(ar) # index = 0 # while index <...
true
cb83cb0e124ec910e572c25548af5f70f4c45ce8
Ruby
mark-ulrich/AdventOfCode2020
/ruby/Day10/adapter_array_two.rb
UTF-8
1,178
3.625
4
[]
no_license
#!/usr/bin/env ruby # Build a tree with a '0' root. Recursively add children to each node for # adapters which are valid (1-3 more joltage). Count the terminating nodes in # the tree to determine total number of valid combinations. # NOTE: Using memoization to complete in this universe's lifetime. Node = Struct.new(:...
true
8c18161d563dbcc6ba2e50716822a44b1a25f518
Ruby
elaguerta/word_guessing_game
/play_game.rb
UTF-8
499
3.453125
3
[]
no_license
require_relative "game" require_relative "player" player_1 = Player.new("Player_1") puts "Welcome to the Word Guessing Game, where if you lose, you get an ASCII Flower." difficulty = player_1.get_difficulty #The Game class takes a difficulty level and an optional secret word. #If you don't provide the secret word, a ...
true
56dd2af5ba1928b423aa1cd2eb5c979720ab1135
Ruby
LauraFlux/lrthw
/ex4.rb
UTF-8
1,720
3.828125
4
[]
no_license
#On enregistre des variables pour pouvoir les reutiliser cars = 100 space_in_a_car = 4.0 drivers = 30 passengers = 90 #On enregistre des calculs de variables # les voiture non utilisees sont egales au nb de voiture moins le nb de chauffeurs cars_not_driven = cars - drivers #Les voitures utilises sont au meme nb qu...
true
1fdc8f568fe218b82087917f1029ac0575e9c1a3
Ruby
etdev/algorithms
/0_code_wars/insert_dashes_.rb
UTF-8
186
2.75
3
[ "MIT" ]
permissive
# http://www.codewars.com/kata/55c3026406402936bc000026 # --- iteration 1 --- def insert_dash2(num) num.to_s.gsub(/([13579](?=[13579]))/, '\1-').gsub(/([2468](?=[2468]))/, '\1*') end
true
78130e5397ee9b21c6de8467169819a4077408b3
Ruby
awksedgreep/runo
/lib/dealer.rb
UTF-8
6,058
3.453125
3
[]
no_license
# frozen_string_literal: true require_relative 'player' require_relative 'human_player' require_relative 'deck' require_relative 'card' require_relative 'colorize' require 'logger' require 'pry' # to play # game = Dealer.new(log: log, players: ['Mark', 'Wesley', 'Josh', 'Mingjia']) class Dealer # deck array attr_...
true
338bcb9be06e6168dfa5be0eddcc4afeac9734c3
Ruby
LiamClark14/ActualizeWork
/js_exercises/practice.rb
UTF-8
2,312
4.65625
5
[]
no_license
# Exercise: (work in pairs) # Solve the following problems first in Ruby, then convert the solution to JavaScript. # 1. Write a function that takes in an array of numbers and returns its sum. # 2. Write a function that takes in an array of strings and returns the smallest string. # def smallest_string(array) # small...
true
37e86e58547d27d4b0fb0f89f96979f8d7e0cddc
Ruby
amandeep1420/ruby-basics-exercises
/5_loops_2_rev2/9_first_to_five.rb
UTF-8
330
4.34375
4
[]
no_license
# my answer: number_a = 0 number_b = 0 loop do number_a += rand(2) number_b += rand(2) if number_a == 5 || number_b == 5 puts "5 was reached!" break end end # correct, though the book uses "next unless" instead of the if statement. # this is similiar to my answer the first time, but slightly more ...
true
c67ec94902fe8172dc16cebc6b613354ac03f9ca
Ruby
codelation/motion-tickspot
/spec/tick/timer_spec.rb
UTF-8
3,629
2.734375
3
[ "MIT" ]
permissive
describe "Tick::Timer" do it "should be defined" do Tick::Timer.is_a?(Class).should.equal true end it "should start a new timer with a task" do task = Tick::Task.new task.id = 1 @timer = Tick::Timer.start_with_task(task) @timer.task.id.should.equal 1 end it "should start the previously ...
true
312aae738fee061b88a6e62424e1c0eb9014d8ec
Ruby
BKMZ90/ThinkNetica
/task2/glasnie.rb
UTF-8
468
3.328125
3
[]
no_license
=begin Заполнить хеш гласными буквами, где значением будет являтся порядковый номер буквы в алфавите (a - 1). =end letter = ("a" .. "z").to_a number = (1..26).to_a vowels = ["a", "e", "i", "o", "u", "y"] all = Hash[letter.zip number] #if Hash[letter].include(vowels) == true h_vowels = {} all.each {|letter, number| ...
true
3320efc3b67c83d6d4fde3bc37e5d018b5f1a0d4
Ruby
MustafaHaddara/advent-of-code-2019
/ruby/day6-2.rb
UTF-8
921
3.484375
3
[]
no_license
#!/usr/bin/env ruby def add_orbit(existing_orbits, new_orbit) s = new_orbit.split(")") center = s[0] orbiter = s[1] existing_orbits[orbiter] = center end def find_path(orbits) you = "YOU" santa = "SAN" santa_path = [] santa_parent = orbits[santa] while santa_parent != nil ...
true
fea63510b62ccac96a383acfa0b60ae58583274c
Ruby
npatel111/prime-ruby-001-prework-web
/prime.rb
UTF-8
250
3.21875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Add code here! def prime?(x) if x == 0 || x == 1 return false else (2...x).each do |n| if x % n == 0 return false end end return true end end
true
3b09df355dddd873fcb9f9e7f9c5746936d333ac
Ruby
octanner/spectre
/app/models/test_filters.rb
UTF-8
863
2.640625
3
[ "MIT" ]
permissive
# frozen_string_literal: true class TestFilters def initialize(tests, filter_by_status = false, params) @tests = tests @params = params @filter_by_status = filter_by_status end def names @tests.map(&:name).uniq.sort_by(&:downcase) end def browsers @tests.map(&:browser).uniq.sort_by(&:do...
true
2a925dc3c2f60a3ec5797e232b8837ffdd8bc9e8
Ruby
eberleant/learn_ruby
/05_book_titles/book.rb
UTF-8
452
4.09375
4
[]
no_license
#write your code here class Book def title= t @title = titleize t end def title return @title end def titleize str little_words = ["the", "and", "over", "in", "of", "a", "an"] str = str.downcase arr = str.split(" ") arr.each_index do |i| if i == 0 or (not little_words.include?(arr[i].downcase)) arr[i] = ...
true
25a0e19b5c0ed9e27b58031cb454aae4a67be3aa
Ruby
totor34/totorminus
/app/models/booking.rb
UTF-8
930
2.765625
3
[]
no_license
# == Schema Information # # Table name: bookings # # id :integer not null, primary key # ride_id :integer # user_id :integer # passenger_number :integer # created_at :datetime not null # updated_at :datetime not null # class Booking < Applicati...
true
b25a81676ec4ec8bd8e6eed8ff7a13a9e60e5bba
Ruby
preetishukla/oyster_card_problem
/lib/oyster_card.rb
UTF-8
1,604
3.390625
3
[]
no_license
require_relative 'oyster_card/card' require_relative 'oyster_card/fare' require_relative 'oyster_card/journey' require_relative 'oyster_card/zone' # Add money £30 to card card = Card.new card.top_up(30) puts "Current balance of card ******** #{card.balance}***************" # Taking Transport Tube: from Holborn to Ear...
true
b215248b2ae7274a3418d0ebf93bb8e3c1ad29ba
Ruby
Spencer197/finance-tracker
/app/controllers/users_controller.rb
UTF-8
1,895
2.6875
3
[]
no_license
class UsersController < ApplicationController def my_portfolio @user = current_user #Ensures user is logged in. @user_stocks = current_user.stocks #Returns all of the user's stocks. end def my_friends @friendships = current_user.friends end def search #The next two lines were replaced...
true
ed71f9196d1e41b28f1f1d9736121aabc9ad0eb6
Ruby
Bhanupriya-S/oakland_nursery_page_object_2021
/features/support/pages/oak_plant_search_page.rb
UTF-8
2,803
2.515625
3
[]
no_license
class OakPlantSearchPage include PageObject # page_url 'https://plants.oaklandnursery.com/12130001' page_url $app_url text_field(:search_plant_edit_box, id: 'NetPS-KeywordInput') button(:submit, id: 'NetPSSubmit') links(:plant_names, class: /NetPS-ResultsP(2|)?Link$/) checkbox :choose_first_result, id:...
true
dfb6ad555cc9438f590d2510c18a7e8c1fdd77e1
Ruby
ChaelCodes/Advent-of-Code-2020
/spec/solutions/day_one_spec.rb
UTF-8
982
2.828125
3
[]
no_license
require 'spec_helper' require './solutions/day_one' RSpec.describe DayOne do describe '.run' do subject { DayOne.run(part) } context 'when part 1' do let(:part) { 1 } it 'calls process on an array of numbers' do is_expected.to eq 605364 end ...
true
a6226c92a8ac056905351da2cdc5625d2693ff65
Ruby
sanmedina/libro_rails
/cap05/Estudiante.rb
UTF-8
489
3.5
4
[]
no_license
require "./Matematicas" require_relative "Persona" class Estudiante < Persona include Matematicas attr_accessor :curso def initialize(nombre = "", apellidos = "", curso = -1) super(nombre, apellidos) initialize_math @curso = curso end def decirPI "PI es igual a #{Matematicas::PI}...
true
9204359c2eb7af5af18fb66384dab491aa9b074f
Ruby
seejohnrun/enforced_interface
/spec/examples/enforced_interface_spec.rb
UTF-8
2,317
2.609375
3
[]
no_license
require 'spec_helper' describe EnforcedInterface do module TestInterface def add(one, two) # Interface method - to be implemented end end context 'when matching method perfectly' do shared_examples_for 'a working interface' do it 'should allow method calls' do expect(klass.new...
true
f2d8e4db81d53adc6e646cdf3fc19e7030219df0
Ruby
StefanoPruna/caffeApp
/spec/ruby_caffe_spec.rb
UTF-8
2,717
3.046875
3
[]
no_license
#testing require_relative "../menu_item" require_relative "../menu" require_relative "../order" require_relative "../caffe" describe MenuItem do it "Should return the price of the item" do name = "caffelatte" price = 2.00 menu_item = MenuItem.new(name, price) expect(menu_item.price)...
true
bed126e6feb63c39acba7f5479ee9a50c9b03e16
Ruby
toxis/piko
/app/models/month.rb
UTF-8
1,123
2.671875
3
[ "MIT" ]
permissive
class Month < ActiveRecord::Base belongs_to :point_times def self.compute_month now = DateTime.now end_time = DateTime.new(now.year, now.month, now.day, now.hour, 0) start_time = end_time - 8.hours average = {} nb = 0 inverters = Inverter.all inverters.each do |inverter| ...
true
f4700ff73a81b407a6073592acef3ea182f7155d
Ruby
camila-santos-ferreira/game-adivinhar-numero
/adivinhar_numero/lib/sortear_numero.rb
UTF-8
838
3.34375
3
[]
no_license
class SortearNumero # método de classe, o self será utilizado para que a classe não precise ser instanciada def self.sortear # criando um array vazio array = [] # abrindo o arquivo para leitura # o File.expand_path serve para criar um caminho a partir de um local # __FILE__ -> começa a partir de...
true
1f0ba4967f9eaa894b57d7267fd98a7b1e9911c1
Ruby
syaifulrmdhn/sql-crowdfunding-lab-cb-gh-000
/lib/sql_queries.rb
UTF-8
1,718
3.140625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your sql queries in this file in the appropriate method like the example below: # # def select_category_from_projects # "SELECT category FROM projects;" # end # Make sure each ruby method returns a string containing a valid SQL statement. def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabe...
true
bea34da478313d0072bd809109542b860f81e6a2
Ruby
sagararathi/chess
/spec/chess_spec.rb
UTF-8
1,379
3.21875
3
[]
no_license
require 'chess' RSpec.describe Chess do let(:knight) { described_class.new('Knight', 'd2') } describe '#get_positions' do context 'available moves for Knight' do it 'returns possible moves for Knight from position d2' do expect(knight.get_positions).to eq "f3, c4, e4, b1, f1, b3" end e...
true
3f0fb17c19734ebf8f5b4fcc906f14d029b88105
Ruby
DaisukeKataoka/ruby_ex
/ex3/ex3_2.rb
UTF-8
205
3.265625
3
[]
no_license
class A def m puts "OK" end protected:m def call_m(a) puts "protected" a.m # オブジェクトaのメソッドを呼び出す end end a = A.new a.m #しかし、インスタンス
true
3bc7de74b28d5ede69c31df62074431b50cfc00f
Ruby
ricardo75777/Project7
/Game/Data/Scripts/source/CMouse.rb
UTF-8
1,523
2.53125
3
[]
no_license
#============================================================================== # ■ Mouse #============================================================================== module CMouse CursorFile = "Graphics/System/Cursor.cur" # 光标文件名(最好包含后缀) EmptyCursor = "Graphics/System/Empty.cur" #空光标 AttackCurso...
true
fb2e7fa79b665f28012d19463e16e047f3da526d
Ruby
dtime/hal_presenters
/lib/hal_presenters/helpers/rels.rb
UTF-8
3,579
2.640625
3
[ "MIT" ]
permissive
module HalPresenters module Helpers module Rels def self.included(klass) klass.extend(ClassMethods) klass.instance_eval do include(InstanceMethods) end end module ClassMethods # Define a rel and the href that goes with it def rel(name, opts = {},...
true