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
643c881a29f5e97c0b2ef7017809f4f12ccfde7e
Ruby
jm/stump
/test/test_stub.rb
UTF-8
1,693
2.796875
3
[ "MIT" ]
permissive
require File.dirname(__FILE__) + '/test_helper.rb' class TestStub < Test::Unit::TestCase def setup end def test_stub_is_set stub_me = MyStump.new assert_nothing_raised do stub_me.stub!(:pants) stub_me.pants end end def test_stub_value_is_returned stub_me = MyStump.new ...
true
4ab1cfe87b0d3dd14bd459c6e05c843698df499f
Ruby
Tecuciztecatl/Ruby
/Ruby - exercises/Books/book_spec.rb
UTF-8
1,422
3.359375
3
[]
no_license
#encoding: utf-8 require './book.rb' describe Book do context "::book_count" do it "Number of books we have created" do book = Book.new book = Book.new Book.book_count.should eq 2 end end context "#Pages" do #Book's pages #This will create a book variable for each it instance instea...
true
2cfad24af0941fc4de9a97b39f70d7fbaeea1898
Ruby
cunger/launch
/challenges/medium1/luhn.rb
UTF-8
539
3.609375
4
[]
no_license
class Luhn def initialize(num) @digits = num.digits end def addends @digits.map.with_index { |digit, index| if index.even? digit else new_digit = 2 * digit new_digit -= 9 if new_digit > 9 new_digit end }.reverse end def checksum addends.sum ...
true
72bc852037432fdf4537af345d11cde547e93af3
Ruby
dmeskis/ruby_exercisms
/acronym/acronym.rb
UTF-8
129
2.828125
3
[]
no_license
class Acronym def self.abbreviate(phrase) phrase.downcase.scan(/\w|\s|/) == phrase.downcase.scan(/\w|\s|/).uniq end end
true
e26352c659ad5e8cb6888cc2b579649b73a14ffb
Ruby
bibendi/cells
/lib/cell/builder.rb
UTF-8
2,262
3.1875
3
[ "MIT" ]
permissive
module Cell # Contains all methods for dynamically building a cell instance by using decider blocks. module Builder # Creates a cell instance. Note that this method calls builders which were attached to the # class with Cell::Base.build - this might lead to a different cell being returned. def create_ce...
true
c586c6ba5ccff7eba446e9b2a8faf261e0355d93
Ruby
adakkak/ruby-x3d
/examples/city/buildings/h2.rb
UTF-8
3,574
2.84375
3
[ "MIT" ]
permissive
require 'rubygems' require 'builder' require '../../lib/X3D' $RAND = 1000000000000000 module Building class House def initialize(args={}) @dim_x = args[:dim_x] || 0.5 @dim_y = args[:dim_y] || 0.5 @dim_z = args[:dim_z] || 0.5 @pos_x = args[:pos_x] || 0 ...
true
b521e25dc1c2270da04fd2ed2fc818d74a287535
Ruby
anujpan/square_array-online-web-prework
/square_array.rb
UTF-8
99
3.5
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def square_array(array) new = [] array.each do |x| new.push( x ** 2 ) end new end
true
150283f287590d4aabc8ca6388efa10ed7392b18
Ruby
Bandwidth/ruby-sdk
/lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb
UTF-8
554
2.65625
3
[ "MIT" ]
permissive
module Bandwidth module Voice module XmlVerb def initialize(data = nil) @data = (data || {}).clone() end def method_missing(name, *args, &block) if name[name.size - 1] == '=' @data[name[0..-2].to_sym] = args[0] else @data[name] end end...
true
65cbdc331bccc2cc77ac3e4e7e6d1b4695937543
Ruby
psyestorm/base-display
/app/helpers/displays_helper.rb
UTF-8
545
2.53125
3
[]
no_license
module DisplaysHelper def showTank(x,y,width,height,spacing,peripheral) tanks=peripheral.tanks return_string="" tanks.each do |key,value| return_string+="drawHorizontalTank(#{x},#{y+(key.to_i-1)*(height+spacing)},#{width},#{height},'#{value["name"]}',#{(value["amount"].to_f/value["capacity"].to_f)})...
true
25ec67e109f6ea257aca0c7c6a480ec432f33a0d
Ruby
vA6corporation/courier
/resources/js/rural.rb
UTF-8
730
3.421875
3
[ "MIT" ]
permissive
kg = 0 base_price = 25 price_1 = 36.27 price_2 = 51.69 price_3 = 120.27 result_price = 0 if kg <= 0.5 result_price = 22.97 puts result_price elsif 0.5 < kg && kg <= 1 result_price = base_price puts result_price elsif 1 < kg && kg <=2 result_price = base_price + (5.85*(kg-1)) puts result...
true
4ddbda73a118317f7219a34c0c8a948c809ac7fd
Ruby
jjmora/THP-Game-Ils-Veulent-tous-Ma-POO
/lib/player.rb
UTF-8
2,704
3.796875
4
[]
no_license
## 2 joueurs ; ## Que chaque joueur ait un niveau de vie donné ; ## Que ce niveau de vie baisse à chaque attaque subie ; ##le niveau de vie est le même pour tout le monde au début (10 pts de vie) ## Si la vie atteint zéro, le personnage est mort. class Player attr_accessor :name, :life_points def init...
true
202b84bb66ce2b906724121c7aafcaf3600892d9
Ruby
calvached/battleship-backend
/spec/validator_spec.rb
UTF-8
705
3.015625
3
[]
no_license
require 'validator' describe Validator do it 'returns true if input is valid' do expect(Validator.validate_board_size('5')).to eq(true) expect(Validator.validate_board_size('7')).to eq(true) expect(Validator.validate_board_size('10')).to eq(true) end it 'returns false if input is out of range for a ...
true
62993526f372d766a26c653610d55196dba22c07
Ruby
sg45000/my_app2
/test/models/user_test.rb
UTF-8
1,080
2.65625
3
[]
no_license
require 'test_helper' class UserTest < ActiveSupport::TestCase def setup @user = User.new(name: "sample", email: "sample@sample.com", password: "foobar", password_confirmation: "foobar") end test "should be valid" do assert @user.valid? end test "name wrong length should ...
true
516fee185ea3af42135723f576bfc5d660decc33
Ruby
aalvrz/project-euler
/problems/ruby/028/number_spiral_diagonals.rb
UTF-8
1,952
4.40625
4
[]
no_license
## Jaime Alvarez -- October 2016 =begin Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: 21 22 23 24 25 20 7 8 9 10 19 6 1 2 11 18 5 4 3 12 17 16 15 14 13 It can be verified that the sum of the numbers on the diagonals is 101. What is the sum...
true
d4b828ec78ae6fb98a44709998ba108395b91cbf
Ruby
rapportive-oss/rediscator
/lib/rediscator/util.rb
UTF-8
6,710
2.546875
3
[]
no_license
require 'open4' module Rediscator module Util class ShellError < StandardError; end def system!(*args) out = '' err = '' default_opts = {:stdout => out, :stderr => err} opts = if args.last.is_a? Hash args.pop else {} end ...
true
81b09ba41626ad1d46041f0cb10a89a381de5e45
Ruby
OlegBandura/food_calculator
/lib/ingredient.rb
UTF-8
214
3.078125
3
[]
no_license
# class Ingredient class Ingredient attr_reader :name, :price def initialize(name:, price:) @name = name @price = price end def ==(other) other.name == @name && other.price == @price end end
true
3698a7aee713d6daf004b5fc8205d462ea884e9a
Ruby
refactor8/prime_multiplication_table
/exe/pmt
UTF-8
250
2.75
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'prime_multiplication_table' if ARGV.empty? puts "Usage: pmt <number> [ATKINS | ERASTOTHENES | TRIAL]" else cli = PrimeMultiplicationTable::CLI.new command = cli.load_command(ARGV.join(" ")) cli.run(command) end
true
2971be8b9b18d522d9051348e11bbf133a8fc2fe
Ruby
ruby-processing/The-Nature-of-Code-for-JRubyArt
/chp05_physicslibraries/toxiclibs/soft_string/chain.rb
UTF-8
2,062
3.203125
3
[ "MIT" ]
permissive
# The Nature of Code # Daniel Shiffman # http://natureofcode.com # A soft pendulum (series of connected springs) class Chain include Processing::Proxy # Chain properties attr_reader :total_length, :num_points, :strength, :radius, :particles, :tail attr_reader :physics, :dragged, :offset # Chain constructor ...
true
8e2882ac2a93a68e5d7ee68afac7fedb8bc6f10c
Ruby
tksmasaki/ruby-practices
/05.ls/ls.rb
UTF-8
3,819
2.859375
3
[]
no_license
#!/usr/bin/env ruby # frozen_string_literal: true require 'optparse' require 'etc' require 'date' require 'io/console/size' def main options = ARGV.getopts('alr') files = retrieve_files(options['a']) files.reverse! if options['r'] options['l'] ? output_fnames_with_details(files) : output_fnames(files) end ...
true
b49630c6a13110bc68e7f995a7bbebc1dc7d77b0
Ruby
jdbernardi/ProjectEulerExercises
/Problems/sum_of_digits.rb
UTF-8
636
4.21875
4
[]
no_license
=begin 2**15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2**1000? =end #PROGRAM sum_of_digits(base, exponent) def sum_of_digits(base, exponent) product = base**exponent #take a value and split - may need to convert to string #inject the value total = ...
true
2137d8c16c6e1cd657cc06efed79ea597deea86d
Ruby
mow-chow/ruby-intro-to-arrays-lab-atlanta-web-060319
/lib/intro_to_arrays.rb
UTF-8
413
3.515625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def instantiate_new_array nuarray = [] nuarray end def array_with_two_elements nuarray = [1,2] nuarray end def first_element(array) array.first end def third_element(array) array[2] end def last_element(array) array.last end def first_element_with_array_methods(array) array.first end def last_eleme...
true
97a6e3545078dbe17b0891fe1cf20c692a6766ad
Ruby
afaur/mongo-copy
/bin/mongo-collection-copy
UTF-8
1,515
2.59375
3
[]
no_license
#!/usr/bin/env ruby require File.expand_path('../../lib/copier.rb', __FILE__) require 'optparse' options = {} parser = OptionParser.new do |opts| opts.on "-s", "--source MONGOURL", "Source MongoDB connection URL" do |arg| options[:source] = arg end opts.on "-d", "--destination MONGOURL", "Destination Mong...
true
649086d41ffc0c67c05354fb492e43110a3c2ed2
Ruby
cmaher92/launch_school
/books/object_oriented_programming/good_dog.rb
UTF-8
549
4.0625
4
[]
no_license
class Animal attr_accessor :name def initialize(name) @name = name end def speak "Hello!" end end class GoodDog < Animal DOG_YEARS = 7 attr_accessor :color, :age def initialize(name, color, age) super(name) @color = color @age = age end def speak super + " from GoodDog...
true
e2ee39471fb21167ad2c51359ea52b7e64a4ea28
Ruby
kimberleyamackenzie/grocery-store
/lib/online-order.rb
UTF-8
2,004
3.203125
3
[]
no_license
require 'csv' require_relative 'order.rb' require_relative 'customer.rb' module Grocery class OnlineOrder < Order attr_reader :id, :products, :customer, :status def initialize(id, products, customer, status: :pending) @id = id @products = products @status = status @customer = Grocery...
true
15eaafda33d5f32ce60f1bf3bf960b1b2c3f07e7
Ruby
plonk/roguelike
/window.rb
UTF-8
3,726
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- require_relative 'sound' class Window def initialize(x = 50, y = 50) @font = Kanji.open("k14-2000-1.bdf", 14) @font.add("a14.bdf") @font.set_coding_system(Kanji::SJIS) @foreground = get_color("white") @background = get_color("blue4") @duration = 0 @default_durati...
true
f63e0e9b42de69259bac62dea00991eeacd44594
Ruby
rhivent/ruby_code_N_book
/book-of-ruby/ch20/send1.rb
UTF-8
124
3.578125
4
[]
no_license
# The Book of Ruby - http://www.sapphiresteel.com name = "Fred" puts( name.send( :reverse ) ) puts( name.send( :upcase ) )
true
464682146a753e58ee14a4e0afe20eaadcfcb3e0
Ruby
jjfarlinger/hard_way
/ex16b.rb
UTF-8
187
3.171875
3
[]
no_license
filename = ARGV.first #opens file txt = open(filename) #Displays string with the filename entered puts "Here is your file #{filename}: " #displays the contents of the file print txt.read
true
e29c03fbb5543beb801246eec9919b2381ffad60
Ruby
killinit/mas-rad_core
/app/models/geocodable.rb
UTF-8
625
2.625
3
[ "MIT" ]
permissive
module Geocodable def self.included(model) model.scope :geocoded, -> { model.where.not(latitude: nil, longitude: nil) } end def latitude=(value) value = value.to_f.round(6) unless value.nil? write_attribute(:latitude, value) end def longitude=(value) value = value.to_f.round(6) unless value....
true
8400cd7d8bcfbe115e1388fb29199b44ffeca4d6
Ruby
zliang-min/justforfun
/lib/render-ish/utils.rb
UTF-8
1,329
3.21875
3
[]
no_license
require 'pathname' module Renderish # Offers some helper methods. So that I needn't monkey-patch Ruby itself. module Utils class << self # Check a file to see if it's a absolute path. # @param [String] file file name # @return True if the file is a absolute path, vice versa. # # @...
true
526e85f600c68de7afe66a0c6d5781c717602259
Ruby
osak/ICFPC2017
/test/kawauso.rb
UTF-8
468
2.578125
3
[]
no_license
#!/usr/bin/env ruby cmd = gets.chomp case cmd when 'INIT' np = gets.to_i my = gets.to_i nv = gets.to_i nm = gets.to_i mines = gets ne = gets.to_i ne.times do edge = gets end puts "ho ge fu ga" puts "hi ge ha ge" when 'MOVE' np = gets.to_i my = gets.to_i nv ...
true
bdedfe6ae4a6d1ef0e5f6d8ccd150a12ea3e6657
Ruby
benjaminolmsted/phase-3-sinatra-react-project
/db/seeds.rb
UTF-8
1,147
2.65625
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
puts "🌱 Seeding spices..." #User.destroy_all #Work.destroy_all u = User.find_or_create_by(email: "b@test.com", password: "hash") #Seed your database here def range (min, max) rand * (max-min) + min end 15.times do |i| hash = {user: u, z_start: rand(-5..0), z_end: rand(1..5), x_start: ran...
true
6f0a3c9703dec989b396d17d4513f5b78c010490
Ruby
dflourusso/curso-programacao
/algoritmos/ruby/sintaxe/case.rb
UTF-8
419
3.8125
4
[]
no_license
x = ARGV.first.to_i case x when 1 then puts "um" when 2 then puts "dois" end case x when 1: puts "um" when 2: puts "dois" end case x when 1; puts "um" when 2; puts "dois" end case x when 1 puts "um" when 2 puts "dois" end class PAR def self.===(numero) numero % 2 == 0 end end class IMPAR < PAR de...
true
8aec9dbde6740c160380127ccb628c516978962e
Ruby
dadooda/ori
/lib/ori/tools.rb
UTF-8
4,339
2.828125
3
[ "MIT" ]
permissive
module ORI # Generic tools. module Tools #:nodoc: ANSI_ATTRS = { :reset => 0, :bold => 1, :underscore => 4, :underline => 4, :blink => 5, :reverse => 7, :concealed => 8, :black => 30, :red => 31, :green ...
true
5c8d672c40321cc22638cb1ed4faacd8932e5cc5
Ruby
msabramo/lita-github_pr_list
/lib/lita/github_pr_list/comment_hook.rb
UTF-8
1,857
2.515625
3
[ "MIT" ]
permissive
module Lita module GithubPrList class CommentHook attr_accessor :request, :response, :payload, :commenter, :issue_owner, :issue_title, :issue_body, :status, :issue_html_url, :redis def initialize(params = {}) self.response = params.fetch(:response, nil) self.reques...
true
36e0784082876cbea3142157319c00cd9eef9d99
Ruby
jnch009/276
/app/models/booking.rb
UTF-8
1,070
2.546875
3
[]
no_license
class Booking < ActiveRecord::Base require 'date' belongs_to :user default_scope -> { order(created_at: :desc) } #validates :user_id, presence: true validates_presence_of :people validates :people, numericality: {only_integer: true, less_than_or_equal_to: 30} validates_presence_of :restauran...
true
920cd043a1e88b4e15531a1af1d04c4faffe4b7a
Ruby
mdoyleaz/Ruby-IP-Calc-API
/server.rb
UTF-8
2,374
2.859375
3
[]
no_license
require 'sinatra' require 'json' require_relative 'ipcalc' ## Switch-Case for handling options passed by API endpoints def calc_case(option, subnet, split = nil) ip = IpCalc.new(subnet) puts split puts subnet case option when 'details' return ip.json_details when 'splitcount' return ip.split_by_nu...
true
be98b3a0e5dc68f026f8590c53423ce5a52ea43c
Ruby
fakefarm/movies_db
/helpers/number.rb
UTF-8
168
2.9375
3
[]
no_license
# frozen_string_literal: true class Number def self.usd(amount) figure = amount.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse "$#{figure} US" end end
true
8864ce83cf32b7c7d7c8bdd3b30dad6d23894f67
Ruby
gtm19/up-in-the-air
/app/helpers/star_rating_helper.rb
UTF-8
382
2.59375
3
[]
no_license
require "font-awesome-sass" module StarRatingHelper def stars(num) num = num.round(1) whole_stars = num.floor half_star = ((num - whole_stars) * 2).to_i empty_stars = ( 5 - (whole_stars + half_star)).to_i # TODO Fix the stars padding icon("fa", "star") * whole_stars + icon("fa", "star-half-al...
true
be1e87feb8350129f006605c82980b40d43108a6
Ruby
maxsunnyday/OO-mini-project-yale-web-yss-052719
/app/models/Recipe.rb
UTF-8
1,048
3.203125
3
[]
no_license
class Recipe attr_accessor :name @@all = [] def initialize(name) @name = name @@all << self end def self.all @@all end def users RecipeCard.all.select do |rc| rc.recipe == self end.map do |rc| rc.user end end ...
true
affa8d563bd1259f8c063372dabdd579d09038e5
Ruby
christopheleray/oc-git
/file1.rb
UTF-8
169
3.25
3
[]
no_license
# programme qui affiche mon prenom et nom puts "Bonjour Je m'appel christophe" puts "quel est ton prénom?" print ">" name = gets.chomp puts "Bonjour #{name}"
true
f37b3565e4e109cec795961b282cb9b7ea85d30a
Ruby
arrowcircle/integration
/lib/integration/integrator/simpson.rb
UTF-8
492
3.171875
3
[ "MIT" ]
permissive
# Simpson's rule # +n+ implies number of subdivisions # Source: # * Ayres : Outline of calculus class Integration::Simpson < Integration::Integrator def initialize(lower_bound, upper_bound, n, &func) super @n += 1 unless @n.even? end def result (step / 3.0) * (func[lower_bound.to_f].to_f + func[upp...
true
3154642742cec1eb6065dfa1c2e0401b0ec8236c
Ruby
IamNorma/sweater_weather
/app/facades/road_trip_facade.rb
UTF-8
553
2.625
3
[]
no_license
class RoadTripFacade def self.fetch_roadtrip_info(origin, destination) roadtrip_data = MapService.route(origin, destination) if roadtrip_data[:info][:messages].empty? latitude = roadtrip_data[:route][:locations][1][:latLng][:lat] longitude = roadtrip_data[:route][:locations][1][:latLng][:lng] ...
true
ce4d67caef603d2033453d09114fdb4ec0728d64
Ruby
tatsushi-imatsu/youtube_rails_practice
/sample.rb
UTF-8
3,397
4.1875
4
[]
no_license
# word = "Hello" # puts word #変数 # data = "データ型の種類 string(文字列) text(長い文字列) integer(整数) date(日付) boolean(真理値)(true,false)" # puts data #配列 # array = ["Tanaka", "Sato", "Suzuki"] # p array[2] # #ハッシュ # User = {"Tanaka" => 21, "Sato" => 18, "Suzuki" => 23} # print(User["Tanaka"]) # #ハッシュとは、キー(Tanaka)とバリュー(21)が一緒になったもの。...
true
45ba6994f84855d1c322d4cf6355e6352013333e
Ruby
xlunchxbox/chaione
/donkey_kong.rb
UTF-8
423
3.9375
4
[]
no_license
def donkey_kong #loop through from 1 to 100 (1..100).each do |n| #Check to see if both divisble by 3 & 5 first, then just 3, then 5, if none #then print the number if (n % 3 == 0) && (n % 5 == 0) print "#{n} Donkey Kong\n" elsif n % 3 == 0 print "#{n} Donkey \n" elsi...
true
c6c371dda40edfc515b11281c1304bb66931ee42
Ruby
AndreaOlarte/MH
/A1/2.ConwaysGame/spec/game_spec.rb
UTF-8
3,747
3.421875
3
[]
no_license
require 'rspec' require_relative '../lib/GameOfLife' RSpec.describe GameOfLife do describe '#fill_grid' do it 'fills the created array representing the grid of the game with new (dead) cells' do game = GameOfLife.new(3, 3) expect(game.cells_grid[0][0].is_alive) == false end end describe '#...
true
a07106926a5ed425dd8d63e86a7b64ad86fe2cba
Ruby
vitor-botechi/gemstack2-api
/spec/routes/products/post_spec.rb
UTF-8
1,537
2.546875
3
[]
no_license
# suite de teste describe "POST /products" do before(:all) do @product = Product.new("papito@ninjapixel.com", "pwd123") @data = YAML.load_file(File.join(Dir.pwd, "spec/fixtures/post.yaml")) end context "dado que eu tenho um produto" do before(:all) do @payload = @data["contra"] ...
true
f51140d56384342b120d4079d6c4375e93e18e04
Ruby
zenozeng/Seven-Languages-in-Seven-Weeks
/ruby/hash-each.rb
UTF-8
541
3.578125
4
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # 这个例子说明 hash 的 each 在只接受一个参数的时候是返回 # ["grandpa", {"dad"=>{"child 1"=>{}, "child 2"=>{}}, "uncle"=>{"child 3"=>{}, "child 4"=>{}}}] # 而非简单的 value 或者 key => value family = { 'grandpa' => { 'dad' => { 'child 1' => {}, 'child 2' => {} }, 'uncle' => { 'child 3' => {}...
true
07a1d494dfb23c624f1281c6dc13f5e937a51867
Ruby
adventcoder/adventofcode-2020
/15_rambunctious_recitation.rb
UTF-8
515
3.515625
4
[]
no_license
require_relative 'common.rb' def get_num(final_turn, starting_nums) last_turn = {} for turn in 1 ... starting_nums.size last_turn[starting_nums[turn - 1]] = turn end num = starting_nums.last for turn in starting_nums.size ... final_turn second_last_turn = last_turn[num] last_turn[num] = turn ...
true
9d7fc92b901c881434d882778f6e4448907e4e43
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/proverb/d8d413a00af145a4b3ba7cbf09fc61ae.rb
UTF-8
418
3.5625
4
[]
no_license
class Proverb def initialize(*items, qualifier: nil) @items = items @qualifier = qualifier end def to_s body + ending end def body s = "" @items.each_cons(2) do |items| s += "For want of a #{items[0]} the #{items[1]} was lost.\n" end s end def ending s = "And all ...
true
0bc2033b3774bc88a5e14d92b1c4342aa23c0d9c
Ruby
vyder/tty-markdown
/examples/table.rb
UTF-8
492
2.625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# frozen_string_literal: true require_relative "../lib/tty-markdown" markdown =<<-TEXT ## Table With Headers | First Header | Second Header | Third Header | |--------------|:-------------:|-------------:| | Text | Text | Text | | Text | Text | Text | | Text ...
true
f22ac04ead6ac3fd9e0a34da58e2b20600e62b1c
Ruby
erikcameron/fmm
/spec/machine_spec.rb
UTF-8
2,358
2.84375
3
[ "MIT" ]
permissive
require 'spec_helper' require './lib/fmm.rb' require './spec/test_machine.rb' describe FMM do let(:state) { FMM::TestMachine.create } it "validates the test machine" do expect(FMM.validate!(state)).to eq(true) end context "when advancing" do let(:new_state) { FMM.trigger!(state, :begin) } ...
true
668779e282c3e47ae9c41ae82057cee497195cb8
Ruby
Dorani/Ruby_on_Rails_Lesson-Plans
/01-Ruby/01-Introduction/05-Comparison_Operators.rb
UTF-8
187
3.28125
3
[]
no_license
== != > < #standard for the most part #where it gets interesting: 10 = 10 #true 10 = 10.0 #true #to make sure data types match use this: 10.eql?(10.0)#False #this will compare the types
true
70a9f6cccc92806e58b1a33c282e5bfaadd8b350
Ruby
open-contracting/european-union-support
/lib/table_builder.rb
UTF-8
6,148
2.625
3
[ "MIT" ]
permissive
class TableBuilder # See README instructions to download this file. FORM_LABELS_CSV_PATH = File.join('source', 'Forms labels R2.09.csv') # Convert markers to badges. BADGES = { 'issue' => 'Issue', 'warning' => 'Attention', 'proposal' => 'Proposal', } # Some XPath's are wider than the "Label an...
true
401ad06b414c9dc0a5426fd23acd3d2b6bb03d91
Ruby
BenRKarl/WDI_work
/w04/d04/Nessa_Nguyen/sum35.rb
UTF-8
165
3.625
4
[]
no_license
sum = 0 #(1...1000).each do |x| # if x % 3 == 0 || x % 5 == 0 # sum += x # end #end (1...1000).each { |x| sum += x if x % 3 == 0 || x % 5 == 0 } puts sum
true
28fdac95c235f0353793be8353e32daa087c8562
Ruby
JimmyReilly/ppv-target-scripts
/links.rb
UTF-8
2,026
3.296875
3
[]
no_license
require 'mechanize' def is_relative_link? link link[0] == '/' end def format_relative_link link, domain link = domain + link link end def remove_paramters link link = link.split('?')[0] if link.include? "?" link end def remove_protocol link link = link.split('//')[1] if link.include? "//" link end def remo...
true
03b4e46c6ff1fde2d9dbee6a9ac3a11d7e60bf3f
Ruby
danilpanshin/Black_Jack2
/deck.rb
UTF-8
370
3.359375
3
[]
no_license
require_relative 'card' class Deck attr_accessor :cards def initialize nums = %w[2 3 4 5 6 7 8 9 10 J Q K A] suits = %w[+ ^ <> <3] @cards = [] nums.each do |n| suits.each do |s| @cards << Card.new(n,s) end end @cards.shuffle! end def give_card new_card = @...
true
5d28dc7cb9583e3a55d95b454b6e731b7399ee3f
Ruby
pda/car_listing_alerts
/lib/fetcher.rb
UTF-8
2,083
2.765625
3
[ "MIT" ]
permissive
# Gem dependencies. require "bundler" Bundler.require # Internal dependencies. require "alert_list" require "car" # stdlib dependencies. require "net/http" class Fetcher BASE_URL = URI("http://www.j-spec.com.au/auction/MAZDA/RX-7") MAX_PAGES = 10 def fetch alert_list = AlertList.new( year_minimum: ...
true
047967cf45b84d0180a02740e7a5f9cf82faf92b
Ruby
bleavs/todo-ruby-basics-prework
/lib/ruby_basics.rb
UTF-8
245
3.015625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def division(num1, num2) num1/num2 end def assign_variable(value) value end def argue (a) a end def greeting (a,b) end def return_a_value "Nice" end def last_evaluated_value "expert" end def pizza_party (a = "cheese") a end
true
b59b0456719ae6fc0a67cd6594ac241914c21bc6
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/etl/559ef40169bc4891be7603357a595182.rb
UTF-8
209
2.875
3
[]
no_license
class ETL def self.transform(old_hash) old_hash.each_with_object(Hash.new(0)) { |(key, values), new_hash| values.each { |value| new_hash.store(value.downcase, key) } } end end
true
5e6211f2098cd5ea7736ec0bc6d4f822cc77cdd5
Ruby
energon-a-secas/enerbot-slack
/scripts/fire.rb
UTF-8
573
2.84375
3
[ "MIT" ]
permissive
# Is the internet on fire? module Internet def self.onfire require 'json' require 'net/http' result = JSON.parse(Net::HTTP.get(URI('https://istheinternetonfire.com/status.json'))) message = ":fire: *#{result['status']}*\n" result['issues'].each do |issue| message += "\t:point_right: #{issue[...
true
e7e5dfeb89dd50f0127e86d9b370ef016543c31a
Ruby
hbellows/world_cup
/test/team_test.rb
UTF-8
1,760
3.078125
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/team' require './lib/player' class TeamTest < Minitest::Test def test_it_exists team = Team.new("France") assert_instance_of Team, team end def test_a_team_starts_with_no_player team = Team.new("France") assert_equal [], team....
true
80098b7c166ec16ce8db05db5140dba6eb392577
Ruby
c-sefkin/library_updated
/spec/book_spec.rb
UTF-8
2,437
2.9375
3
[]
no_license
require("spec_helper") describe(Book) do describe('#name') do it("returns the name") do book = Book.new({:name => "Oceans Eleven", :id => nil}) expect(book.name()).to(eq("Oceans Eleven")) end end describe('#id') do it('returns the id') do book = Book.new({:name => "Oceans Eleven", :id => 1}...
true
4f3f6edfab61887f7299335d9a18740f6d5bdc9c
Ruby
jsbalrog/ruby-examples
/src/wellGroundedRubyist/ch03/ticket.rb
UTF-8
569
3.265625
3
[]
no_license
class Ticket attr_reader :venue, :date attr_accessor :price def Ticket.most_expensive(*tickets) tickets.max_by(&:price) end def initialize(venue, date) @venue = venue @date = date end VENUES = ["Convention Center", "Fairgrounds", "Town Hall"] end th = Ticket.new("Salt Palace", "11/12/13"...
true
ab6662d100d78488aedc65739be5684c5abb8459
Ruby
charlie/rack_middleware_state
/middle_ware_one.rb
UTF-8
2,116
3.71875
4
[]
no_license
require 'rack' # A class meant to demonstrate two things: # # 1. There is one and only one instance of each piece of middleware. If you # modify the value of one of its instance variables, the next request will use # the modified value. Some middleware, such as Sinatra, avoids this situation # with the dup.call! patte...
true
aa7901a0579aa8278b2385543b68a676216270c3
Ruby
timestep/piglatin-jquery
/piglatin_jin.rb
UTF-8
249
3.5625
4
[]
no_license
def piglatin(x) array = x.downcase.split("") until "aeiou".include? array.first first_letter = array.shift array = array + [first_letter] end array = array + ["ay"] return array.join end puts piglatin("tree") puts piglatin(tree)
true
e187a6615b91a3828c343fd99bd0e24b282d6d08
Ruby
edensongjbs/key-for-min-value-yale-web-yss-052520
/key_for_min.rb
UTF-8
370
3.703125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# prereqs: iterators, hashes, conditional logic # Given a hash with numeric values, return the key for the smallest value def key_for_min_value(name_hash) min_key=nil name_hash.reduce(nil) do |memo, (key, value)| puts "Memo: #{memo} Key: #{key} Value: #{value}" if !memo || value<memo memo=value ...
true
7847c5d040cb32c2dbd1ce151733c7f95e0bc1c9
Ruby
sonots/daioikachan
/lib/fluent/plugin/filter_string_irc_slack.rb
UTF-8
1,199
2.515625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'string/scrub' if RUBY_VERSION.to_f < 2.1 module Fluent class StringIrcSlackFilter < Filter Plugin.register_filter('string_irc_slack', self) COLOR_CODE = "\x03" # \u0003 BOLD = "\x02" # \u0002 UNDERLINE = "\x1f" # \u001F INVERSE = "\x16" # \u0016 CLEAR = "\x0f" # \u000...
true
b93fd0847b84210d6ec0003754589e570a9d6240
Ruby
LocalOrbit/localorbit
/lib/product_import/formats/xlsx.rb
UTF-8
759
2.546875
3
[ "MIT" ]
permissive
module ProductImport module Formats class Xlsx def enum_for(filename:, **rest) Enumerator.new do |yielder| require 'rubyXL' begin workbook = RubyXL::Parser.parse(filename) rescue Zip::Error => e raise e, "XLSX file format error: #{e}", e.backtra...
true
aa0e9d8beff5fd54484c8e65821b51d1469a2743
Ruby
holywyvern/carbuncle
/gems/carbuncle-core/mrblib/errors.rb
UTF-8
885
2.703125
3
[ "Apache-2.0" ]
permissive
# This module contains all Carbuncle's game engine related classes module Carbuncle # This class is the baisc error, where all other errors extend from class Error < StandardError; end # This error is thrown when a game is attempt to start when one is already running. class GameIsRunning < Error; end # This...
true
1a7ff33b4ac16da9e65dae46a014d67b0cd34745
Ruby
archan937/monetdb
/test/unit/connection/test_messages.rb
UTF-8
1,664
2.53125
3
[ "MIT" ]
permissive
require_relative "../../test_helper" module Unit module Connection class TestSetup < MiniTest::Test class Connection < SimpleConnection include MonetDB::Connection::Messages end describe MonetDB::Connection::Messages do before do @connection = Connection.new ...
true
e8e83b851e8dfbc1d478396496081295d79bde94
Ruby
madhalle/enigma_final
/lib/enigma.rb
UTF-8
3,168
3.46875
3
[]
no_license
require_relative 'key' require_relative 'offset' require_relative 'shift' class Enigma attr_reader :message, :key, :date, :alphabet, :shift, :encrypted_message def initialize(message, key = Key.new, date = Offset.new) @message = message @key = key.generate @date = date.generate @alphabet = [] @...
true
18573b5fd74fb28ea6090284c3ce4b394392a911
Ruby
GauthierStricker/rails-longest-word-game
/app/controllers/games_controller.rb
UTF-8
703
2.859375
3
[]
no_license
require 'open-uri' require 'json' class GamesController < ApplicationController def new @letters = Array.new(9) { [*("A".."Z")].sample } end def score @userinput = params[:userinput] @current_game_letters = params[:current_game_letters] if @userinput.upcase.chars.all? { |char| @current_game_let...
true
7404d9fb1d333e0cd831e779a997d91703f4b113
Ruby
jwfreed/OO-mini-project-dumbo-web-career-010719
/app/models/RecipeCard.rb
UTF-8
284
2.96875
3
[]
no_license
class RecipeCard attr_accessor :user, :recipe, :date, :rating @@all = [] def initialize(user, recipe, date, rating) @user, @recipe, @date, @rating = user, recipe, date, rating @@all << self end # should return all of the RecipeCard instances def self.all @@all end end
true
700c39870d14ee7b95da12298c3c7bcb10264e78
Ruby
EssenceOfChaos/cryptom
/config/initializers/blockio.rb
UTF-8
754
2.515625
3
[]
no_license
require 'block_io' BlockIo.set_options :api_key => Rails.application.secrets.block_api, :pin => Rails.application.secrets.block_pin, :version => 2 # Now you're good to go. Here's an example call: # BlockIo.get_new_address(:label => 'shibe1') # Bitcoin d9dc-bbb7-cb86-618d # User A, we'd want to call get_new_address ...
true
c083b85b9655006da8d4ed148e6a90384ef78568
Ruby
symondsandson/Quill-Lessons
/app/models/chunk.rb
UTF-8
1,261
2.890625
3
[]
no_license
class Chunk attr_reader :chapter, :chunk, :state, :input delegate :rule, to: :@chunk delegate :classification, to: :rule class MissingChunkError < Exception ; end def initialize chapter, options @chapter = chapter @chunk = chapter.assessment.chunks[options[:id]] if @chunk.nil? raise Miss...
true
0ca0a6b5423428617adc6dde854b3a24a2e4029f
Ruby
rebekahkim/ruby
/Week4/trials.rb
UTF-8
466
3.75
4
[]
no_license
#Week 4 trials places = { "a1"=>'X',"a2"=>'X',"a3"=>'X', "b1"=>' ',"b2"=>' ',"b3"=>' ', "c1"=>' ',"c2"=>' ',"c3"=>' ' } possible_victory = [ ['a1','a2','a3'], ['b1','b2','b3'], ['c1','c2','c3'], ['a1','b1','c1'], ['a2','b2','c2'], ['a3','b3','c3'], ['a1','b2','c3'], ['c1','b2','a3'] ...
true
4f1ba8223c15a285e234c6b18535119c8009a1e7
Ruby
made-line/ruby-practice
/ltp/ch6grandma.rb
UTF-8
270
3.515625
4
[]
no_license
puts "Hi grandchild" grandchild_response = gets.chomp.to_s year = (rand(1930..1951)) if grandchild_response == grandchild_response.downcase puts "HUH?! SPEAK UP, SONNY!" elsif grandchild_response == grandchild_response.upcase puts "NO, NOT SINCE #{year}!" end
true
e723f66823410d2c2c53981f2bcc032f423161ce
Ruby
Souravgoswami/ruby-masterclass
/Section 29: Cryptography - String IV/Part3_Using_the_digest_gem.rb
UTF-8
863
3.21875
3
[ "Unlicense", "LicenseRef-scancode-proprietary-license" ]
permissive
#!/usr/bin/ruby -w # Encoding: UTF-8 # Sun Jul 21 05:17:32 2019 # ruby 2.6.3 # PART 2 # The digest gem has many algorithms implemented. # We first have to require it: require 'digest' p Digest::SHA1.new.digest(?a) p Digest::SHA1.new.digest ?a p Digest::SHA2.new.digest ?a p Digest::SHA256.new.digest ?a # Compute di...
true
30bc41bd9b5622eec9f2e9a3dce802305000112d
Ruby
LWooJoo/python_ruby
/loop/loop.rb
UTF-8
718
4.0625
4
[]
no_license
puts("Hello world 0") puts("Hello world 9") puts("Hello world 18") puts("Hello world 27") puts("Hello world 36") puts("Hello world 45") puts("Hello world 54") puts("Hello world 63") puts("Hello world 72") puts("Hello world 81") while false do # ruby에서는 while (true,false) do로 표기 puts('Hello world') end puts('after wh...
true
347654b248b004e972bcce82f9002bd3a37d3459
Ruby
emalfano/intro-to-programming
/methods/methods_ex_6.rb
UTF-8
341
2.765625
3
[]
no_license
# Methods ex 6 =begin ArgumentError: wrong number of arguments (1 for 2) from (irb):1:in `calculate_product' from (irb):4 from /Users/username/.rvm/rubies/ruby-2.0.0-p353/bin/irb:12:in `<main>' =end # This error message tells us that when calling method calculate_product you arepassing the wrong number of argum...
true
eaf0a3652a210652d5da3090d5c43206888af170
Ruby
fredwu/action_throttler
/lib/action_throttler/config.rb
UTF-8
307
2.609375
3
[ "MIT" ]
permissive
module ActionThrottler class Config def initialize @config ||= {} end def to_hash @config end def method_missing(key, value) # converts `key=()` methods to `key()` key = key.to_s.sub(/=$/, "").to_sym @config[key] = value end end end
true
4468145776e7d719386a24261473d7c074bdc4d0
Ruby
mdemers4/crm_assignment
/crm_assignment.rb
UTF-8
3,712
3.546875
4
[]
no_license
=begin As a user, upon starting the CRM, I am presented with a prompt to add, modify, delete, display all, search by attribute, and exit. As a user, if I select add I am prompted to enter a 'first name', 'last name', 'email' and 'note'. As a user, if I select modify I am prompted to enter an id for the contact to be m...
true
c2e8d3ce9c42152f88ae9c4156a1b590390d8920
Ruby
tvinod/wpchallengewebapp
/app/helpers/wp_graph_search.rb
UTF-8
12,470
2.78125
3
[]
no_license
require 'rest-client' require 'json' require 'set' $wp_base_30 = "http://proapi.whitepages.com/3.0/" $wp_base_22 = "http://proapi.whitepages.com/2.2/entity/" # $api_key = "api_key=c5ec1bbbc3394afb991ce53e1ad2c7c8" $api_key = "" $default_max_depth = 6 module WpGraphSearch def find_person(name, city, state_code) ...
true
d6355747f5f10c12fa980d64b6f7d9e033b8ce90
Ruby
malclocke/go-railscamp-2016
/sgf.rb
UTF-8
1,006
3.328125
3
[]
no_license
class SgfStatement attr_reader :key, :value def initialize(statement) @key, @value = statement.match(/([A-Z]+?)\[(.+?)\]/)[1,2] end end class Sgf include Enumerable attr_reader :string def initialize(string) @string = string end def to_s string end def each string.split(';').ea...
true
c7c6855e53bf3bd749287eba78bf5b8bbce96013
Ruby
nettan20/third_base
/benchmark/date.rb
UTF-8
1,075
2.984375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'benchmark' require 'date' require 'third_base/date' n = 20000 puts "Date vs. ThirdBase::Date: #{n} Iterations" Benchmark.bm do |x| GC.start; x.report("Date.new "){n.times{Date.new(2008, 1, 1)}} GC.start; x.report("ThirdBase::Date.new "){n.times{ThirdBase::Date.new(200...
true
8ce546fbae64b332ed1353edffbeb78fc3831f5b
Ruby
Emetselch1984/practice_rspec0211
/practice_rspec0211/wday-hash_rspec.rb
UTF-8
889
3.203125
3
[]
no_license
require_relative 'wday-hash' describe do let(:wday){ { sunday: "日曜日", monday: "月曜日", tuesday: "火曜日", wedensday: "水曜日", thursday: "木曜日", friday: "金曜日", saturday: "土曜日", } } it "ハッシュの値の確認" do expect(wday[:sunday]).to eq "日曜日" end it "ハッシュの値ので...
true
0607803ef22178a71213ee06a5e91a0f48a4ebfd
Ruby
gabaza/ruby_fundamentals2
/excercise4.rb
UTF-8
317
4
4
[]
no_license
# Define a method that accepts a string as an argument and # returns false if the word is less than 8 characters long # (or true otherwise). def no_long(word) word_is_long = false if word.length < 8 puts word_is_long else word_is_long = true puts word_is_long end end no_long("Alaskahahaha")
true
f3000999989ef35f6be486e3f17be5b3cb8b0d9b
Ruby
wockenfuss/craigslist_scraper
/lib/craigslist.rb
UTF-8
795
2.59375
3
[]
no_license
require 'nokogiri' require 'open-uri' require 'mail' require 'date' require 'sqlite3' require_relative './db.rb' require_relative './listing.rb' DB.database_file = ENV.fetch('DATABASE') { 'db/development.db' } module Craigslist def self.fetch(url) open(url) end def self.nokogiri(url) Nokogiri::HTML(fe...
true
5ceabc1e423c65dccdcf4bd1dfbeeaeb7af98b1b
Ruby
tsteer050/AA-Classwork
/W7/D1/big_o/max_windowed_range.rb
UTF-8
3,766
3.578125
4
[]
no_license
require 'byebug' #Phase I def windowed_max_range(arr, w) current_max_range = nil arr.each_with_index do |el, i| next if i+w > arr.length window_arr = arr[i...i+w] difference = window_arr.max - window_arr.min current_max_range ||= difference current_max_range = differen...
true
039f913165992d54cd35f314cd0a7ee007b0f124
Ruby
maneeshacd/crypto_task
/Question_2_Programming/spec/models/transaction_spec.rb
UTF-8
775
2.5625
3
[]
no_license
require 'spec_helper' require 'cryptocompare' require 'date' require_relative '../../lib/models/transaction.rb' RSpec.describe Transaction do before do @transaction = Transaction.new( { 'timestamp' => '1571967208', 'transaction_type' => 'DEPOSIT111', 'token' => 'BTC', 'amount' => 0.29866 ...
true
16aa90db525574cffc2c09ed7dfd4eb3c08b1227
Ruby
jbrunton/jira-team-metrics
/spec/stats/jira_team_metrics/date_range_spec.rb
UTF-8
4,154
2.609375
3
[ "MIT" ]
permissive
require 'rails_helper' RSpec.describe JiraTeamMetrics::DateRange do let(:start_date) { DateTime.new(2001, 1, 1) } describe "#to_a" do context "if the range is empty" do let(:range) { JiraTeamMetrics::DateRange.new(start_date, start_date) } it "returns an empty list" do expect(range.to_a)....
true
261e3c961003412b3386e87e16e720be6addbee0
Ruby
MDes41/random
/marina_array/marina_array.rb
UTF-8
1,459
2.78125
3
[]
no_license
class SortArray def initialize attr_reader :possible_small_responses, :possible_large_responses, :possible_shots attr_accessor :computer_placement def initialize @possible_small_responses= [["A1", "A2"], ["A2", "A3"], ["A3", "A4"], ["B1", "B2"], ["B2", "B3"], ["B3", "B4"], ["C1", "C2"], ["C2", "C3"], ["C3...
true
f688a9cf588911448ada7eece99fe8981e8c74ab
Ruby
eneagoe/adventofcode2017
/day7.rb
UTF-8
1,410
3.171875
3
[]
no_license
#!/usr/bin/env ruby -w require 'tsort' require 'awesome_print' require 'graphviz' class Hash include TSort alias tsort_each_node each_key def tsort_each_child(node, &block) fetch(node).each(&block) if key?(node) end end @tree = Hash.new { |h, key| h[key] = [] } @weights = Hash.new { |h, key| h[key] = [...
true
796c5997ea3bf7608dc747015bd7eea615ca71d5
Ruby
csuhta/environment
/bin/instagram-dl
UTF-8
664
2.828125
3
[ "Unlicense" ]
permissive
#!/usr/bin/env ruby # Downloads an image from Instagram # Usage: instagram-dl INSTAGRAM-URL-HERE require "down" require "nokogiri" @instagram_id = ARGV[0].to_s.match(/\/p\/([A-Za-z0-9\-_]{9,11})/)[1] if @instagram_id.nil? raise ArgumentError, "Couldn’t find an Instagram ID in the given URL" end @instagram_page =...
true
d0b1c3902d69ef1f15717b9845567460598a91b4
Ruby
shofira/ruby-basic
/typedata.rb
UTF-8
67
3.0625
3
[]
no_license
nama = 'shofira' puts nama.class number = 123 puts number.class
true
e3a74cd86f26733265f80e245b28ebfc16c59769
Ruby
geckods/CodeForces
/498-Div3/e.rb
UTF-8
696
3.09375
3
[]
no_license
nq = gets.chomp.split(" ").map(&:to_i) n = nq[0] q = nq[1] qarr = [] treearr = gets.chomp.split(" ").map(&:to_i) q.times {qarr.push gets.chomp.split(" ").map(&:to_i)} hash = Hash.new([]) treearr.each_with_index do |x,i| hash[x] += [i+2] end #p treearr p hash def generateseq(hash,x,i) if i == 1 return x end...
true
e1d05c3fed6a81322680e2981de20b11b875b7cf
Ruby
jichen3000/colin-ruby
/test/eval/instance_eval_context.rb
UTF-8
537
2.734375
3
[]
no_license
require 'test/unit/testcase' class OtherObject def identify return "in other object" end def use_call &arg arg.call end def use_instance_eval &arg instance_eval &arg end end class StaticContext < Test::Unit::TestCase def identify return "in static context" ...
true
363c4cbe08a18c0375627ea281d86bb0db6f1b4d
Ruby
richardcchen/programming_languages-nyc-web-080618
/programming_languages.rb
UTF-8
571
2.8125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reformat_languages(languages) require "pry" # your code here new_hash = {} languages[:oo].each do |lan, data| data.each do |value, type| #binding.pry new_hash[lan] = {value => type, :style => []} end new_hash[lan][:style] << :oo end languages[:functional].each do |lan, data| ...
true
bc2efb5d36078ed9b7ecdba228af9c63cfc11edb
Ruby
RusskikhMaksim/RubyLabs
/lab1/spec/converter_spec.rb
UTF-8
1,758
2.671875
3
[]
no_license
require_relative '../lib/converter' RSpec.describe Converter do let(:converter_obj) { Converter.new } describe '.convert_celsius' do context 'when conversion to kelvin' do it do converter_obj.num_of_degrees = -273.15 converter_obj.from_scale = 'C' converter_obj.to_scale = 'K' ...
true
71a344b8b88846c1ed6e8ec7db404bd3facdd2db
Ruby
samullen/dotfiles
/.irbrc
UTF-8
529
3
3
[]
no_license
class Object def interesting_methods (self.methods - Object.instance_methods).sort end def unique_methods ancestors = self.class.ancestors - [self.class] (self.methods - ancestors.map(&:instance_methods).flatten).sort end end class Array def self.test_list(x=10) (1..x).to_a end end class H...
true