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
9d3d838ee2cc90e35e9d914216ee0457e6ccddb5
Ruby
trnunes/explorationDSL
/lib/adapters/rdf/lib/refine_interpreter.rb
UTF-8
4,465
2.65625
3
[]
no_license
class SPARQLFilterInterpreter include SPARQLHelper @@accepted_filters = ["RefineAux::And", "RefineAux::Or", "RefineAux::Equals", "RefineAux::Contains", "RefineAux::EqualsOne", "RefineAux::LessThan", "RefineAux::LessThanEqual", "RefineAux::GreaterThan", "RefineAux::GreaterThanEqual"] ACCEPT_PATH_QUERY = false...
true
8328c5f99a20bd6ece961979b6d35b3b00dfd348
Ruby
cmvandrevala/doughnut
/spec/retirement_calculator/expenses_spec.rb
UTF-8
6,615
2.84375
3
[ "MIT" ]
permissive
require "spec_helper" module Doughnut describe Expenses do before(:each) do @expenses = Expenses.new end describe "parameters" do it "returns average monthly expenses of $2500" do expect(@expenses.monthly_expenses).to eq 2500 end it "updates the average monthly expens...
true
52d985ca108a96a08a0224b9128000a5f5d3dd10
Ruby
michaeld55/Karaoke_Bar_HW
/song.rb
UTF-8
91
2.6875
3
[]
no_license
class Song attr_reader( :name ) def initialize( name ) @name = name end end
true
60f06acd77d93d23f21976622e9ca6eea67d86c2
Ruby
cesaroangelo/URLResponseTime
/responseTime.rb
UTF-8
403
2.859375
3
[ "Apache-2.0" ]
permissive
require 'net/http' require 'uri' def responseTime(host) begin url = URI.parse(host) startTime = Time.now response = Net::HTTP.get(url) endTime = Time.now - startTime if endTime > 300 puts "response time : #{endTime}" else puts "response time less than 5 minutes" end rescue...
true
2a1433f0e6c2cefc5bc019b7a525dde5d090b0b0
Ruby
cbisio/juego_gosu
/Bloque.rb
UTF-8
263
2.96875
3
[]
no_license
require 'gosu' require './Entidad' class Bloque < Entidad attr_reader :x, :y def initialize(window,x,y) @image = Gosu::Image.new(window, "brick.png", true) super x, y, @image end def draw() @image.draw(@x, @y, 0) end end
true
2ecc83da75e33f9c66ba8920602f81d3cc8f0aed
Ruby
mwagner19446/wdi_work
/w01/d04/Quincy/receipt_reader.rb
UTF-8
110
2.53125
3
[]
no_license
f = File.open("receipt.txt", "r") string_version_of_receipt = f.read puts string_version_of_receipt f.close
true
ac63cb303aa662ca8f1f25f32c3f6f024802ea5e
Ruby
mattwd7/recruiter
/app/services/personal_page_crawler.rb
UTF-8
1,648
2.75
3
[]
no_license
class PersonalPageCrawler include CrawlerCommon CLUE_WORDS = %w(resume linkedin github) def self.call(url) new(url).crawl end attr_reader :url def initialize(url) @url = url @page = Mechanize.new.get(url) rescue => e "ERROR 1.5: #{e}" end def crawl puts "external: #{url}" if looks_like_persona...
true
d907d468da5e250c5b5216413c1f15ca7ce7314a
Ruby
S-Mcilroy/week_3_day_3_homework
/db/console.rb
UTF-8
716
2.796875
3
[]
no_license
require("pry") require_relative("../models/album") require_relative("../models/artist") Album.delete_all Artist.delete_all artist1 = Artist.new( { 'name' => 'Linkin Park' } ) artist2 = Artist.new( { 'name' => 'Daft Punk' } ) artist1.save artist2.save album1 = Album.new( { 'title' => 'Hybrid T...
true
a537c1586b2c5458a019b7be372eb0b2f8fc66c9
Ruby
yshrkume/crawler
/sbcr0.rb
UTF-8
318
2.90625
3
[]
no_license
require 'pry' page_source = open('samplepage.html', &:read) dates = page_source.scan(%r{(\d+)年\s?(\d+)月\s?(\d+)日<br />?}) puts dates[0,4] url_titles = page_source.scan(%r{^<a href="(.+?)">(.+?)</a><br />}) puts url_titles[0,4] puts dates.length puts url_titles.length binding.pry puts dates.zip(url_titles)
true
5426379286fab5b4119051d6614452471a9a4a89
Ruby
agpiermarini/exercism
/ruby/linked-list/linked_list.rb
UTF-8
1,306
3.578125
4
[]
no_license
class Deque def initialize @head = nil @tail = nil end def push(node = @head, value) return set_head(value) if list_empty? new_node = node.next ? push(node.next, value) : node.append(Node.new(value)) @tail = new_node end def pop return clear_list if list_length_one? new_tail, val...
true
0328ad3d3a0a493d23a34445709fde2cd82dc78d
Ruby
DhanashriJoshi/rack-app
/user_data.rb
UTF-8
1,132
2.703125
3
[]
no_license
require 'mysql2' class UserData def self.create begin con = Mysql2::Client.new(host: 'localhost', username: 'root', password: 'root') con.query("CREATE DATABASE IF NOT EXISTS rack_app") con = Mysql2::Client.new(host: 'localhost', username: 'root', password: 'root', database: 'rack_app') ...
true
6e2e12239dabc655c273dfec0dedbee02101b37f
Ruby
popenuj/assignment_rspec_ruby_tdd
/spec/stock_picker_spec.rb
UTF-8
846
3.5625
4
[]
no_license
require 'stock_picker' describe '#stock_picker' do it 'raises an error if not given parameters' do expect{ stock_picker }.to raise_error(ArgumentError) end it 'raises an error if not given an array' do expect{ stock_picker(1) }.to raise_error(ArgumentError) end it 'raises an error if array has less...
true
b9f8c26857d65fd4daa51f900e8142cf1de44712
Ruby
YOU310/csv_task
/read.rb
UTF-8
240
2.890625
3
[]
no_license
# csvファイルを読み込むのに必要 require "csv" require "pry" list = CSV.read("members.csv", headers: true).map do |row| { id: row["id"].to_i, 名前: row["name"], あだ名: row["nickname"], 所属: row["belong"] } end p list
true
85d6b0b7bd64e0aad4382c041f1c5398a41d28e7
Ruby
FelixAlvarado/Binary-Search-Tree
/lib/bst_practical.rb
UTF-8
157
2.90625
3
[]
no_license
def kth_largest(tree_node, k) tree = BinarySearchTree.new(tree_node) ordered_data = tree.in_order_traversal tree.find(ordered_data[k * -1]) end
true
69e40ff3c65b06950dc34ef0022b2ef8a68f1a9b
Ruby
tinbka/rmtools
/lib/rmtools/core/arguments.rb
UTF-8
1,565
2.734375
3
[ "Ruby", "MIT" ]
permissive
# encoding: utf-8 class Array # a, b, opts = [<hash1>].fetch_opts([<hash2>, <object1>]) may work unintuitive: # you'll get <hash1> as `a' and not as `opts' # So if function is not implying that some argument other than `opts' definetly # must be a hash, don't make hash default. # Better put hashie argume...
true
60fbbdd92e5f1ab416d961c42d182c00cbeffc5b
Ruby
TelAPI/telapi-ruby
/lib/telapi/configuration.rb
UTF-8
1,077
2.765625
3
[ "MIT" ]
permissive
require 'ostruct' module Telapi class Configuration < OpenStruct #:nodoc: def initialize super( :base_uri => 'https://api.telapi.com/2011-07-01', :ssl_ca_path => '/etc/ssl/certs', :account_sid => nil, :auth_token => nil ) end def inspect marshal_dump...
true
f4e2279fc77329ba4b3fa153676394d9be528ef1
Ruby
mayalexandera/ruby-project-alt-guidelines-nyc01-seng-ft-060120
/lib/models/recipe_meal.rb
UTF-8
395
2.515625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class RecipeMeal < ActiveRecord::Base belongs_to :meal belongs_to :recipe #def self.recipe_by_meal(user) # meal_ids = user.meals.map{ |meal| meal.name if meal.id } # recipe_ids = user.recipes.map { |rec| rec.id } # puts meal_ids # puts recipe_ids # RecipeMeal.select{ |rec_me| recipe_ids.includes?(...
true
8e4f77434f57d946810036064ceb2f683e43f348
Ruby
prasadsurase/hootcode
/lib/exercism/explore.rb
UTF-8
859
2.875
3
[]
no_license
module Exercism module Explore class Conversation def self.load(path) JSON.parse(File.read(path)).map.with_index do |iteration, i| code = iteration['code'] language = iteration['language'] comments = iteration['comments'].map {|comment| Comment.new(comment)} Iteration.new(cod...
true
8d154e06ba888f58c87c3ebe314d2c546e0b9278
Ruby
mlisareyes/video-games-cli
/lib/video_games/scraper.rb
UTF-8
781
2.703125
3
[ "MIT" ]
permissive
class Scraper BASE_URL = "https://www.gamestop.com" def self.scrape_games page = Nokogiri::HTML(open("https://www.gamestop.com/browse/games/playstation-4?nav=28-xu0,131dc-ffff2418")) page.css('.product').each do |game| title = game.css('.ats-product-title a').text url = game.css('.ats-produc...
true
b7333ad4770d94fd0fec5bf9c1ddd497a31c48e6
Ruby
NSantrax/tutu
/app/models/railway_station.rb
UTF-8
1,605
2.5625
3
[]
no_license
class RailwayStation < ApplicationRecord validates :title, presence: true has_many :trains has_many :railway_stations_routes has_many :routes, through: :railway_stations_routes scope :ordered, -> { select('railway_stations.*, railway_stations_routes.station_number').joins(:railway_stations_route...
true
08f83dd03b749d70ec38e981ab7f43ac1481eae0
Ruby
siromanto/codewars_katas
/ruby/remainder.rb
UTF-8
994
4.3125
4
[]
no_license
# Write a function that accepts two arguments and returns the remainder # after dividing the larger number by the smaller number. # Division by zero should return NaN. Arguments will both be integers. # escribe 'Remainder Function' do # it 'Should handle arguments and math as defined in specificaitons' do # T...
true
908929de3a19659e2be8afa618ba6e729c045ce4
Ruby
TheCalebThornton/root_codescreen
/lib/models/trip.rb
UTF-8
265
3.453125
3
[]
no_license
require 'time' class Trip attr_accessor :start, :stop, :miles def initialize(start, stop, miles) start.delete!(':') stop.delete!(':') @start = Time.strptime(start, '%H%M') @stop = Time.strptime(stop, '%H%M') @miles = miles.to_f end end
true
74f6fe839498adb0b338ddb2820b10570b55acdd
Ruby
chrisrp/porky_invest
/lib/helpers/chupinhador_indice_base.rb
UTF-8
263
2.65625
3
[]
no_license
require 'nokogiri' class ChupinhadorIndiceBase attr_reader :taxa, :data def chupinhar page = Nokogiri::HTML(RestClient.get(url)) @taxa = extrair_taxa(page) @data = extrair_data(page) rescue => e Rails.logger.error(e.message) end end
true
ba207e7c55d0d1b3a9c822a2b204e862d2469868
Ruby
rigel-eva/hack-night-snowman
/snowman.rb
UTF-8
2,723
3.921875
4
[ "MIT" ]
permissive
SNOWMAN=[ ' ________ | | | | <============> / \ | * * | | => | \ `---` / \|/ ------- \|/ \ / * \ / \=== * ===/ | * | \ / --------- / * \ / * \ | ...
true
96a0e120ee4153505c241bfe65a9cc280c43fcae
Ruby
MichaelTheTall/W2D2LAB
/specs/bus_spec.rb
UTF-8
1,398
3.25
3
[]
no_license
require("minitest/autorun") require("minitest/rg") require_relative("../bus.rb") require_relative("../person.rb") require_relative("../bus_stop.rb") class BusTest < MiniTest::Test def setup @bob = Person.new("Bob", 25) @annie = Person.new("Annie", 40) @alan = Person.new("Alan", 30) @greg = Person.ne...
true
4e4b8fd0d97f207ea0a80a2c9735d4dec42e8d43
Ruby
elbagre/WRK-W2D3-Peter-McKinley-Chase-Martin
/poker/lib/hand.rb
UTF-8
229
3.34375
3
[]
no_license
class Hand attr_reader :cards, :deck def initialize(deck) @deck = deck @cards = [] draw_hand(deck) end def draw_hand(deck) 5.times { draw } end def draw @cards << @deck.cards.shift end end
true
9bd38d9cd6e42262b651dd04578f1511b5ffda87
Ruby
banister/pry
/lib/pry.rb
UTF-8
8,870
2.578125
3
[ "MIT" ]
permissive
# (C) John Mair (banisterfiend) 2011 # MIT License # require 'pp' require 'pry/helpers/base_helpers' require 'pry/hooks' class Pry # The default hooks - display messages when beginning and ending Pry sessions. DEFAULT_HOOKS = Pry::Hooks.new.add_hook(:before_session, :default) do |out, target, _pry_| next if _...
true
4465493144b715cb1957968f58048a8f528479e3
Ruby
chrislomaxjones/Ruby-programs
/snippets/reflection/types_classes_methods.rb
UTF-8
3,358
4.03125
4
[]
no_license
# The most commonly used reflective methods are those for determining the type # of an object. - what class it is an instance of and what methods it responds to o = "Hello world" p o.class # => String (returns class of object o) p o.class.superclass # => Object (returns superclass of class c) p o.instance_of? Strin...
true
ed78dacdfe305b1f8187f4d7167b318eff1920c9
Ruby
DouglasAllen/code-Metaprogramming_Ruby
/raw-code/PART_II_Metaprogramming_in_Rails/gems/activeresource-2.3.2/lib/active_resource/formats/xml_format.rb
UTF-8
1,073
2.734375
3
[]
no_license
#--- # Excerpted from "Metaprogramming Ruby: Program Like the Ruby Pros", # published by The Pragmatic Bookshelf. # Copyrights apply to this code. It may not be used to create training material, # courses, books, articles, and the like. Contact us if you are in doubt. # We make no guarantees that this code is fit for ...
true
389e92436465c46c543c82a48657f1fff1f45192
Ruby
avanover0311/Ruby
/range.rb
UTF-8
103
3.125
3
[]
no_license
# a = (-1..25) # puts a.last() # puts a.max() # puts a.min() # puts a.include?(29) puts (1..255).to_a
true
087be8744fb6a7f8083fa67c117efdee7f02e5e9
Ruby
spolks-2013-2014-sem1/050501_razboev
/lab2/1.rb
UTF-8
247
2.6875
3
[]
no_license
require 'socket' TCPServer.open('127.0.0.1',3000) {|srvr| if (server =srvr.accept) loop{ string = server.gets.chomp server.print "#{string.reverse} \n\r" puts "#{string}" if string == "sd" server.close end } end }
true
cc223f2e18d360ba7db027d2b1fe046b5b786845
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/anagram/cb6185dcd7214febacaaaf91e0cc1e4c.rb
UTF-8
553
3.703125
4
[]
no_license
class Anagram attr_reader :word def initialize(word) @word = EncodedWord.new(word) end def match(possibilities) possibilities.select { |possibility| word.anagram_of? possibility } end class EncodedWord attr_reader :original, :encoded def initialize(word) @original = word.downcase ...
true
4a82a1834871555e09b02b558fc385a3499aa7d2
Ruby
FloraHarvey/student-directory
/directory.rb
UTF-8
3,190
3.9375
4
[]
no_license
@students = [] def print_header puts "The students of Villains Academy" puts "----------------" end def print_footer if @students.count > 0 puts "Overall, we have #{@students.count} great student#{sing_or_plural(@students)}" else puts "We currently have no students." end end def sing_or_plural(person)...
true
dd6b6f9e1f808ed7b455dc99e405d3632b63e71d
Ruby
charliecorrigan/little-shop
/app/models/address.rb
UTF-8
985
2.59375
3
[]
no_license
class Address < ApplicationRecord validates :address_type, presence: true validates :street_address, presence: true belongs_to :user belongs_to :city belongs_to :state belongs_to :zipcode enum address_type: [:home, :billing] accepts_nested_attributes_for :city, :state, :zipcode def city_attribut...
true
ed6e1797f50f8b8a0da822dea02385ba4a694e0c
Ruby
noesya/osuny
/app/services/importers/hash_to_person.rb
UTF-8
3,053
2.75
3
[ "MIT" ]
permissive
module Importers class HashToPerson def initialize(university, hash) @university = university @hash = hash @error = nil extract_person_variables if valid? person.save add_picture_if_possible!(person) end end def valid? if country_not_found? ...
true
e0bce14b1493317f2c56b0f73f67f44f16499697
Ruby
aisleypay/prime-ruby-web-040317
/prime.rb
UTF-8
235
3.625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def prime?(num) return false if num != num.abs || num == 0 || num == 1 primes = (2..num).to_a for divisor in primes break if divisor * divisor > num return false if num % divisor == 0 end true end puts prime?(-5)
true
cd3cc7212f14f33cfb88af23a69af3b515f1edf1
Ruby
chrisnatali/nv
/app/models/product.rb
UTF-8
510
2.65625
3
[]
no_license
class Product < ActiveRecord::Base has_and_belongs_to_many :tags, :order => "name" #if tag_name is not nil, return the list of products #associated with the tag. Otherwise return 'em all def self.salable_items(tag_name) if tag_name == nil or tag_name == "" find(:all) else tag = Tag.find...
true
51e064843fe108ceb06ecaf3a495cc4026d3e892
Ruby
nagerz/backend_prework
/day_6/launch_exercises.rb
UTF-8
1,297
3.515625
4
[]
no_license
class MyCar #Wanted to be able to change and view year and model attr_accessor :year, :model #Can view but not modify the color attr_reader :color def initialize(y, c, m) @year = y @color = c @model = m @speed = 0 end def accelerate(number) @speed += number end def brake(number) ...
true
a046a4893af135dfd3dc63d2eae2b18a26c0f508
Ruby
mpissanos/badges-and-schedules-online-web-prework
/conference_badges.rb
UTF-8
408
3.65625
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(names) names.map { |i| "Hello, my name is #{i}."} end def assign_rooms(names) names.map.with_index {|name , index| "Hello, #{name}! You'll be assigned to room #{index + 1}!" } end def printer(names) batch_badge_creator(name...
true
646c53ebf13aa081bfdbffa670e70421ba5fff86
Ruby
MishaConway/ruby-conversocial
/lib/conversocial/resources/models/base.rb
UTF-8
4,960
2.59375
3
[ "MIT" ]
permissive
module Conversocial module Resources module Models class Base include Conversocial::Utils::Strings attr_reader :loaded_attributes, :contents def initialize params={} disable_association_resolving do @loaded_attributes = {} @contents = [] ...
true
15206c1d91d954401ee0d261dbc917fcf2f9192e
Ruby
uservidya/ruby-fizzbuzz
/lib/fizzbuzz.rb
UTF-8
2,596
3.421875
3
[ "Apache-2.0" ]
permissive
# -*- encoding: utf-8 -*- # :stopdoc: # # fizzbuzz.rb # # Copyright 2012-2013 Krzysztof Wilczynski # # 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/LICE...
true
6ef7589cbf79b0df1e6bd0661afa51d591e98d12
Ruby
meh/LOLastfm
/lib/LOLastfm/client.rb
UTF-8
932
2.671875
3
[]
no_license
#-- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # Version 2, December 2004 # # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION # # 0. You just DO WHAT THE FUCK YOU WANT TO. #++ require 'socket' require 'json' c...
true
4de80b71e4c6484b15c6b37221c32e06f9849a82
Ruby
tanase/13ro
/rating.rb
UTF-8
3,799
3.015625
3
[]
no_license
# -*- coding: utf-8 -*- require "yaml" require "fileutils" require "./elo" DBFILE = "db.yaml" FileUtils.cp(DBFILE, DBFILE + ".bak") DEFAULT_PENALTY = 20 $db = YAML.load_file(DBFILE) || {users: [], penalty: DEFAULT_PENALTY} DEFAULT_RATING = 1500 def usage puts "See readme.txt" exit 1 end def find(name) for play...
true
e14823d986c569155fc29f2177661a7f30e43256
Ruby
brettbevers/aiml-engine
/lib/aiml/utils.rb
UTF-8
1,914
2.515625
3
[ "MIT" ]
permissive
require 'find' module AIML module Cache def self.dumping(aFilename,theGraphMaster) File.open(aFilename,'w') do |file| file.write(Marshal.dump(theGraphMaster,-1)) end end def self.loading(aFilename) File.open(aFilename,'r') do |file| return Marshal.load(file.read) end rescue nil e...
true
3c4366a5902b45f82f695053cd4d43c2cfa9aece
Ruby
joshmrallen/reading-errors-and-debugging-using-pry-lab-nyc01-seng-ft-071320
/fix_using_tests/the_final_frontier.rb
UTF-8
360
3.28125
3
[]
no_license
# don't forget to add: require 'pry' require 'pry' def generate_star_date (rand(100000) + 400000) / 10.0 end def state_log(star_date) "Captain's Log, star date #{star_date}." end def engage date = generate_star_date puts state_log(date) #date was being defined on the last line which meant that starlog was b...
true
51f299792a15a148ac897715a9980d631016aa69
Ruby
TonyCWeng/Practice_Problems
/challenges/bicycle_inventory/test.rb
UTF-8
413
2.921875
3
[]
no_license
require_relative 'item_counter' example = Ride.new("07:20", "08:30","1 diamond, 1 emerald") example2 = Ride.new("08:00", "09:30","3 diamonds, 1 snowball") example3 = Ride.new("09:00", "10:00","3 kiwis, 2 emeralds, 1 snowball") Inventory = ItemCounter.new("Inventory Counter") Inventory.process_ride(example) Inventory....
true
fd7b20de5a8288a31fb5a65b6e1ad39590cec307
Ruby
sajad-moradi/recode-ruby-project
/exercise_61/tower_of_hanoi.rb
UTF-8
1,581
3.828125
4
[]
no_license
def iterative_tower_of_hanoi(disks, source, destination, bridge) min_move = 2 ** disks - 1 for i in 1..min_move if i % 3 == 1 if destination.empty? destination.push(source.pop) elsif source.empty? source.push(destination.pop) elsif destination.last > source.last destina...
true
739cc111ba20e517db972a9d2063f1fbac51f24a
Ruby
madetech/academy-2018-tetris
/lib/fall_down_naturally.rb
UTF-8
592
2.578125
3
[]
no_license
# frozen_string_literal: true class FallDownNaturally def initialize(piece_gateway:) @piece_gateway = piece_gateway end def execute(*) if @piece_gateway.falling_piece.type == :I coordinates = [6, 36] shape = [ [nil,nil,:X,nil], [nil,nil,:X,nil], [nil,nil,:X,nil], ...
true
b6807ae4df96600efd4ff426fc95f60048fcdb48
Ruby
darrenpicard25/jungle-rails
/spec/models/user_spec.rb
UTF-8
3,460
2.703125
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do before do @user = User.new firstname: "Darren", lastname: "Picard", email: "test@test.com", password: "hello", password_confirmation: "hello" @user2 = User.new firstname: "Darren", lastname: "Picard", email: "tEsT@teSt.com", password: "hello", passw...
true
4e4c9c02c94b9a442b5338ea5d2cfb10321bf20d
Ruby
DrRobotmck/dinr
/spec/models/restaurant_spec.rb
UTF-8
1,472
2.640625
3
[]
no_license
require 'spec_helper' describe Restaurant do describe '#new' do before do 9.times{FactoryGirl.create(:restaurant)} end it { should validate_presence_of :name } it { should validate_presence_of :camis } it { should validate_presence_of :building } it { should validate_presence_of :street } it { should...
true
cb38383d34b0b0351e192f9231cddc63bc30dbbe
Ruby
Chenelenen/symbiont
/test/symbiont-with-watir.rb
UTF-8
1,049
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby $: << './lib' require 'symbiont' include Symbiont::Factory class Decohere attach Symbiont url_is 'https://decohere.herokuapp.com/' url_matches /decohere/ element :open_form, id: 'openLogin' text_field :username, id: 'username' text_field :password, id: 'password' button :...
true
649baa81e94193ec4a451ac70bf4a043efb69a12
Ruby
herwinw/spec
/core/string/to_c_spec.rb
UTF-8
1,565
2.5625
3
[ "MIT" ]
permissive
require_relative '../../spec_helper' require_relative '../../shared/kernel/complex' require_relative 'fixtures/to_c' describe "String#to_c" do it_behaves_like :kernel_complex, :to_c_method, StringSpecs end describe "String#to_c" do it "returns a complex number with 0 as the real part, 0 as the imaginary part for ...
true
f522eb3dbdf2796bd4ee666482b0db30d4321057
Ruby
matthewstclaire/key-for-min-value-onl01-seng-ft-081720
/key_for_min.rb
UTF-8
243
3.25
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def key_for_min_value(name_hash) array_ordered_by_age = [] array_ordered_by_age = name_hash.collect {|name, age| age}.sort name_hash.each do |name, age| if age == array_ordered_by_age[0] return name end end nil end
true
4680c2352ca7f49cf11ef6a1e471d0cbceb6c7e3
Ruby
aleclamson/methods-quiz
/methods_quiz.rb
UTF-8
636
3.1875
3
[]
no_license
module MethodsQuiz def has_teen(a, b, c) if a >= 13 && a <= 19 || b >= 13 && b <= 19 || c >= 13 && c <= 19 true else false end end # TODO - write not_string def icy_hot(a, b) if a < 0 && b > 100 true else false end end def closer_to(num, guess1, guess2) if (num - guess1) == (num...
true
93cdce42bff9bc281de0d5fc446c484a1c6ce081
Ruby
anilreddy/watir-robot
/lib/watir_robot/keywords/list.rb
UTF-8
1,289
3.203125
3
[]
no_license
module WatirRobot # # Functionality related to ordered and unordered HTML lists # module List ### Actions ### # # Get text from the items of a list # # The second argument can be "true" or "false"; true for ordered list, false (default) for unordered. # # @param [String...
true
5287155fd24c5e510180d0f1ac684269a20e3088
Ruby
kevthunder/good-and-evil-kings
/app/models/ressource.rb
UTF-8
855
2.5625
3
[]
no_license
class Ressource < ActiveRecord::Base def alias name.parameterize('_') end def find(r) if r.is_a? Ressource r elsif ressource.is_a?(String) || ressource.is_a?(Symbol) find_by_name(ressource) else super(r) end end class << self def persistent debugger ...
true
893cee3cc748c10736910fdf539c1c27a2713570
Ruby
medusa-project/active-medusa
/lib/active_medusa/repository_error.rb
UTF-8
861
2.609375
3
[ "NCSA", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module ActiveMedusa class RepositoryError < StandardError # @!attribute status_code # @return [Integer] The HTTP response status code. attr_accessor :status_code # @!attribute status_line # @return [String] The HTTP response status line. attr_accessor :status_line # @!attribute bod...
true
501fbb94f0a26a8db2b4800ec3499d0e7bad82df
Ruby
learn-academy-2021-delta/week-5-assessment-AnthonyC4848
/ruby-challenges.rb
UTF-8
2,949
4.53125
5
[]
no_license
# ASSESSMENT 5: Ruby Coding Practical Questions # MINASWAN # --------------------1) Create a method that takes in an array of words and a single letter and returns all the words that contain that particular letter. beverages_array = ['coffee', 'tea', 'juice', 'water', 'soda water'] letter_o = 'o' # Expected output: ...
true
cee836ccbefb22106c018e327683d2a5a1f75228
Ruby
jacob-s-son/game_of_life
/lib/game_of_life/apply_world_rules.rb
UTF-8
280
2.6875
3
[]
no_license
module GameOfLife class ApplyWorldRules class << self def apply( world ) new(world).apply end end def initialize(world) @world = world end def apply @world.cells[ '0,2' ] = DeadCell.new( 0,2 ) @world end end end
true
f35b2f567cbf2ebfe5c5d1d6a37b389c88b42750
Ruby
richardforth/ruby-tidbits
/ruby2_3_3/course_files/UDEMY_Learn_to_Code_with_Ruby/Section_07_Ranges/alphabetical_ranges.rb
UTF-8
798
3.90625
4
[ "Unlicense" ]
permissive
letters = "a".."z" p letters p letters.class p letters.first(3) p letters.last(3) #p letters.length # error (NoMethodError) p letters.count # 26, as you'd expect letters = "A".."Z" p letters.class p letters.first(3) p letters.last(3) #p letters.length # error (NoMethodError) p letters.count # Also 26, as you'd expect...
true
8f4b5a444173b70898db62c87e94e86128737e8f
Ruby
zeteticl/udonarium
/src/src_bcdice/diceBot/WaresBlade.rb
UTF-8
801
2.859375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # frozen_string_literal: true class WaresBlade < DiceBot # ゲームシステムの識別子 ID = 'WaresBlade' # ゲームシステム名 NAME = 'ワースブレイド' # ゲームシステム名の読みがな SORT_KEY = 'わあすふれいと' # ダイスボットの使い方 HELP_MESSAGE = "nD10>=m 方式の判定で成否、完全成功、完全失敗を自動判定します。\n" def check_nD10(total, _dice_total, dice_list, cmp_o...
true
36ac06a3ec5ae0377152228ee455158194c4119c
Ruby
noelledusahel/phase-0-tracks
/ruby/list/todolist.rb
UTF-8
610
3.578125
4
[]
no_license
class TodoList def initialize(list_arr) @todo_arr = list_arr end def get_items @todo_arr end def add_item(item) @todo_arr << item end def delete_item(item) @todo_arr.delete(item) end def get_item(index) @todo_arr [index] end end # get_items("do the dishes", "mow the lawn") # def get_items(x,y) # TodoList_ar...
true
48dc8991dd19f4c10e4ffeb8393ab2c069a2576d
Ruby
nigeriangirl/ruby-objects-has-many-lab-v-000
/lib/song.rb
UTF-8
145
3.15625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_accessor :name, :artist def initialize(name) @name = name end def artist_name self.artist.name if self.artist end end
true
b5c58b6aa6d788294109abca252a7320ae570d0a
Ruby
ivansiata/pokemon_rainbow
/app/models/pokemon_battle.rb
UTF-8
1,505
2.71875
3
[]
no_license
class PokemonBattle < ApplicationRecord extend Enumerize belongs_to :pokemon1, class_name: 'Pokemon' belongs_to :pokemon2, class_name: 'Pokemon' belongs_to :pokemon_winner, class_name: 'Pokemon', foreign_key: 'pokemon_winner_id', optional: true belongs_to :pokemon_loser, class_name: 'Pokemon', foreign_key: 'p...
true
9ff9f26141d79591588fc0a8f8db86708974febd
Ruby
seppo0010/aRSS
/subscription.rb
UTF-8
6,909
2.65625
3
[]
no_license
# Copyright 2011 Sebastian Waisbrot. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions an...
true
1a9a714eba5f0fc897e551e81488e4933cc04b34
Ruby
Mvrkwr23/fizzb
/app1.rb
UTF-8
228
3.609375
4
[]
no_license
# numbers = [] counter = 0 100.times do # numbers.push(counter) counter = counter +1 if counter % 3 == 0 puts fizz elsif counter % 5 == 0 puts buzz elsif counter % 15 == 0 puts fizzbuzz else puts counter end
true
6890e196c92fd35503eb1eb7f2cdced4caba90f7
Ruby
Yorickov/railway
/spec/station_spec.rb
UTF-8
2,020
3.1875
3
[]
no_license
require 'entities/station' require 'entities/train' require 'entities/passenger_train' require 'entities/cargo_train' require 'entities/route' describe Station do before(:context) do @station = Station.new('Atlanta') @passenger_train = PassengerTrain.new('fre-tr') @cargo_train = CargoTrain.new('ub2-tr') ...
true
39274026753bf4a480ebba6321350a3997405c1d
Ruby
Beertaster/cli_proj_ws
/lib/news.rb
UTF-8
330
2.75
3
[ "MIT" ]
permissive
class News_Scrape::news attr_accessor :name, :body, :hidden @@all = [] def initialize(name, body, hidden) @name = name @body = body @hidden = hidden @@all << self end def self.all @@all end def self.find_by_index(index) @@all[index] en...
true
7662caed48c0fdb213e62e211fc79d100d5165d1
Ruby
waldyrious/git.tmbundle
/Support/app/helpers/annotate_helper.rb
UTF-8
861
2.6875
3
[ "MIT" ]
permissive
module AnnotateHelper def selected_line_range lines = parse_selection_string(ENV['TM_SELECTION']).flatten [lines.min, lines.max] end # Parses the selection string and includes an array containing the lines # selected in the document def parse_selection_string(str) str.split('&').map do |range| ...
true
7fb320f4a1785f8e20f7c17cd9e0dd2cde1117ce
Ruby
deezy136/triangle-classification-onl01-seng-pt-100619
/lib/triangle.rb
UTF-8
874
3.203125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Triangle # write code here def initialize(equilateral, isosceles, scalene) @equilateral = equilateral @isosceles = isosceles @scalene = scalene end def kind() if @equilateral <= 0 || @isosceles <= 0 || @scalene <= 0 raise TriangleError elsif (@equilateral + ...
true
488a9c6334c243b3a4eea03438ac0c4e0f253295
Ruby
tonatiuh8/precourse
/hashexercise3.rb
UTF-8
438
3.484375
3
[]
no_license
team_city = {London: "Chelsea", Manchester: "Man U", Roma: "AS Roma"} team_city.each_key { |key| puts key } team_city.each_value { |value| puts value } team_city.each { |key, value| puts "#{key} is home to #{value}" } opposites = {positive: "negative", up: "down", right: "left"} opposites.each_key { |key| puts key }...
true
13c4cf8c90e110d4d4650f906e270e9cd768a521
Ruby
marim0ss/testadd
/calc_class.rb
UTF-8
424
3.5625
4
[]
no_license
class Calculator attr_accessor :sum attr_accessor :array #attr_accessor :makearray def initialize self.sum = 0 self.array = [] end #makearray = [] def makearray(num) num.times do |n| self.array[n] = n end end def sum_array #self.array.each do |num| この2行の処理が #self.sum += num ...
true
2a0b15fccccda75955e316a0c6d0a471e9c1b264
Ruby
BobbyCarlos/intro_to_programming_with_ruby
/5_loops_iterators/l_ex4.rb
UTF-8
121
3.28125
3
[]
no_license
def countdown(num) if num <= 0 then return else puts num countdown(num - 1) end end countdown(100)
true
0cf1c95240d0c91900b3808cc70ac9b1ccf9f9f3
Ruby
riddochc/riemann-monitors
/bin/riemann-ntp
UTF-8
747
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # Reports NTP stats to Riemann. require_relative "../lib/riemann-monitors" class Riemann::Monitors::Ntp include Riemann::Monitors def initialize @hostname = Socket.gethostname end def tick stats = `ntpq -p -n` stats.each_line do |stat| m = stat.split() next if m....
true
3d3e4eeb5827739473438fe4c7645745fdff912c
Ruby
Marineepo/code_exe
/demo_sorter.rb
UTF-8
1,259
3.75
4
[]
no_license
require 'rspec' def total_sorter invoices invoices.sort_by do |Invoice| invoice.total end.reverse end Invoice = Struct.new(:name, :total, :category) google = Invoice.new('Google', 500, 'Marketing') amazon = Invoice.new('Amazon', 1000, 'eCommerce') yahoo = Invoice.new('Yahoo', 300, 'Marketing') invoices = [go...
true
527228926d476e44c50c72e8faeb5a0c1f5231eb
Ruby
claudiob/keith
/lib/keith.rb
UTF-8
2,802
2.796875
3
[]
no_license
class Keith def self.hi [ 'Keith has never not been bald', 'Keith pretends to know German', 'Keith does all his work in dreamweaver', "Keith's favorite color is transparent", "Keith owns ten pairs of jeggings", "Keith finds Kierkegaard's presupposition on existentialliasm to be...
true
d55fb2d99e8e95fcd51d2406266b12b2abe712c3
Ruby
RobertTTaylor9517/crud-with-validations-lab-atlanta-web-111819
/app/models/song.rb
UTF-8
721
2.640625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song < ApplicationRecord validates :title, presence: true validate :title_repeat validates :artist_name, presence: true validate :release_date def release_date if released == false && release_year errors.add(:release_year, "Not released") elsif released == true && ...
true
623509f62de996cbc61509a45e693db3f3da22bc
Ruby
Raggon/Ruby
/exersize6i2.rb
UTF-8
793
3.46875
3
[]
no_license
class ShoppingCart def initialize @items = [] end def add_item(item) @items.push(item) end end class Item attr_reader :name, :price def initialize(name, price) @name = name @price = price end def price price = @price end end class Houseware < Item def price if @price...
true
849c3bd279707e5e529fcf5bb8278c10e6dbe158
Ruby
arbaouimehdi/ruby-coding-interview
/interviewcake/linked-lists.rb
UTF-8
160
2.90625
3
[]
no_license
class LinkedListNode attr_accessor :value, :next, :previous def initialize(value) @value = value @next = nil @previous = nil end end
true
78a9f0940321012179960f9cbe8215f30153c684
Ruby
MacInnes/battleship
/game.rb
UTF-8
2,347
3.671875
4
[]
no_license
require './lib/board' require './lib/tile' require './lib/ship' require './lib/computer' require './lib/user' require './lib/print_messages' module Battleship def initial print = PrintMessages.new # refactor to module puts print.start_game input = gets.chomp.downcase if input == "p" || input == "p...
true
77b795bbbb824a94f530ada9caebc936a0c19a0c
Ruby
nnattawat/basic-ruby
/class/inherit.rb
UTF-8
557
4.125
4
[]
no_license
class A def self.hello puts "hello world" end end puts A.hello # hello world class B < A def self.bye puts "Bye!" end end puts B.hello # hello world puts B.bye # Bye! class C < B def self.bye puts "Bye overwritten" end def self.hello # call the parent method using super # super without () mean u...
true
c05b0fd21956c749276aae62dabf8ff65c2021f4
Ruby
takagotch/rb3
/entry.rb
UTF-8
1,721
2.515625
3
[]
no_license
class Entry < ActiveRecord::Base belongs_to :blog end class ActiveRecord::Base belongs_to :blog, :counter_cache => true end class Entry < ActiveRecord::Base has_many :taggings has_many :tags, :through => :taggings def tag_string=(tag_string) tag_names = tag_string.split(/\s/) self.tags = tag_names...
true
a50789f0afe89e6dfc9a84c046ff0e21461e130c
Ruby
andreamazza89/learn_to_program
/ch13-creating-new-classes/extend_built_in_classes.rb
UTF-8
482
3.609375
4
[]
no_license
class Integer def factorial recursive_fact self end def recursive_fact n n == 1 ? 1 : n * recursive_fact(n-1) end def to_roman base_5_convert(self.to_s[-4].to_i, 'M', '_', ) + base_5_convert(self.to_s[-3].to_i, 'C', 'D', ) + base_5_convert(self.to_s[-2].to_i, 'X', 'L', ) + base_5_conver...
true
d56bbb5f476bb3326eb920de2a9bcc3f8232cf1a
Ruby
Orasi/DevOpsTraining-Seed
/app/reports/testcase_status.rb
UTF-8
4,546
2.546875
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
require 'axlsx_styler' class TestcaseStatus def self.color_by_status status case status.upcase when 'PASS', 'PASSED' return '0d7024' when 'FAIL', 'FAILED' return 'ff3333' when 'SKIP', "SKIPPED" return 'ffcc00' when 'NOT RUN' return 'b2b2b2' else ...
true
7a3de80fb3058a73d51d1017daa06102c56f330a
Ruby
kpapacostas/my-collect-web-103017
/lib/my_collect.rb
UTF-8
274
3.578125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def my_collect(array) return 0 if array.length == 0 if block_given? times = array.length - 1 i = 0 new_array = [] while i <= times new_array << (yield array[i]) i += 1 end else "No block was given!" end new_array end
true
019ccc81b665e2abb3cb8612c8fd4f04980ebd63
Ruby
dan3lson/leksi
/app/models/classroom.rb
UTF-8
390
2.625
3
[]
no_license
class Classroom < ActiveRecord::Base belongs_to :teacher has_many :students, dependent: :destroy validates :name, presence: true validates :grade, presence: true validates :teacher, presence: true scope :alphabetical, -> { order("LOWER(classrooms.name)") } def has_students? !Student.where(classroom...
true
4f14b2d4f0d0f86126e7986b5390841341d76ef5
Ruby
sajg1/w1d3_hashes_arrays_exercises
/exercise_b_users.rb
UTF-8
2,495
3.625
4
[]
no_license
users = { "Jonathan" => { :twitter => "jonnyt", :lottery_numbers => [6, 12, 49, 33, 45, 20], :home_town => "Stirling", :pets => [ { :name => "fluffy", :species => "cat" }, { :name => "fido", :species => "dog" }, { :name => "spike", :species => "d...
true
efcabeeb76af20ee0de49060358a2f01b83ae3af
Ruby
GrantjHanrahan/wdi27-homework
/Bhagavathi_Chirra/week4/MTA/mta.rb
UTF-8
3,650
3.65625
4
[]
no_license
# # require 'pry' # # @lines = { # n: ["Times Square", "34th", "28th", "23rd", "Union Square", "8th"], # l: ["8th", "6th", "Union Square", "3rd", "1st"], # six: ["Grand Central", "33rd", "28th", "23rd", "Union Square", "Astor Place"] # } # # def plan_trip(starting_line, starting_station, ending_line, ending_stat...
true
26a3609bbf4826b233cd28aab1de3b47d1fa1d91
Ruby
yunglleung1/school-domain-nyc-web-071618
/lib/school.rb
UTF-8
1,029
3.9375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' # code here! class School attr_reader :roster, :school def initialize(school) @school = school @roster = {} #has an empty roster when initialized end def add_student(student_name, grade)#adds a student if @roster[grade] != nil @roster[grade] << student_name #add multiple studen...
true
9a1e02c418277114309d9e5263cc416265e9bc86
Ruby
danielosorio83/tic_tac_toe
/app/models/game.rb
UTF-8
2,721
3.453125
3
[]
no_license
class Game attr_accessor :size, :table, :player, :movements, :table_size NEUTRO = '-' PLAYER_1 = 'X' PLAYER_2 = 'O' PLAYERS = [PLAYER_1, PLAYER_2] def initialize(size = 3) self.size = size.to_i self.table_size = @size * @size self.player = PLAYERS.sample self.table = Array.new(table...
true
1eb180f7d0e1da30f107804ed8f73d4f1bf67d51
Ruby
yycruby/metaprogramming-examples
/reopening_a_class.rb
UTF-8
394
3.875
4
[]
no_license
class BaseClass def base_method "pump up the bass!" end end class MyClass < BaseClass def my_method "you called my method!" end end class MyClass def another_method "you called a different method" end end obj = MyClass.new p obj.my_method #=> "you called my method!" p obj.base_method #=> "pum...
true
59d2623cb48fc2c1662d0f2034de5032597c948f
Ruby
EricFries/poll-tracker
/app/models/estimate.rb
UTF-8
1,945
2.921875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Estimate < ActiveRecord::Base belongs_to :candidate def self.latest_dem_chart Pollster::Chart.where(:topic => '2016-president-dem-primary').first.estimates end def self.latest_gop_chart Pollster::Chart.where(:topic => '2016-president-gop-primary').first.estimates end def self.load_iowa ...
true
abc93f81a604b76d2552db20a2521760d35c6486
Ruby
karlitxo/cantango
/lib/cantango/configuration/factory.rb
UTF-8
1,415
2.6875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module CanTango class Configuration module Factory def clear! @factory = nil end def factory factory = nil raise "Factory must be a callable, either a lambda or Proc" if !callable? factory @factory = factory end alias_method :factory=, :factory def fa...
true
51106d878e90a0d7afab76ef65e0a7f387edd3b2
Ruby
karthicksmail/progs
/rb/sum1000.rb
UTF-8
123
3.53125
4
[]
no_license
count = 0 sum = 0 1000.times do count+=1 sum+=count end puts "The sum of the first 1000 numbers is " + sum.to_s
true
f838594d45a0300ce76a5345c90429619e0212cd
Ruby
danielglatstein/TicTacToe
/tic_tac_toe.rb
UTF-8
11,020
4.25
4
[]
no_license
=begin Tic tac toe seemed like a simple game until I began building it in Ruby. The task proved to be an exciting challenge. In the process, I learned about the logic skills required to simplify an object down to its most essential functions. The exercize helped me to become much more technically proficient a...
true
f6306d4d1e0b50c806bb9c944ce48c933b0fdcf8
Ruby
jordantroberts/codewars
/Codewars/spammy_marketing_email.rb
UTF-8
806
3.4375
3
[]
no_license
#You are sending out a marketing campaign for your company, Code-o-matic. #But you want to personalise the emails so that the people don't think they are being spammed! #You will be given a string of marketing text called campaign and a hash person. #In the string campaign, there will be three personalisable elements...
true
267c8a1fb22d7262aa72ce951c02cbc8cea4a76a
Ruby
JustinD85/BATTLESHIP
/test/ship_test.rb
UTF-8
852
3.171875
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/ship' require 'pry' class ShipTest < Minitest::Test attr_reader :ship def setup @ship = Ship.new("Cruiser", 3) end def test_it_exists assert_instance_of Ship, ship end def test_it_has_attributes assert_equal 'Cruiser', ship.n...
true
33f7ca31bfdc965752157f12956188f33ed0a4bc
Ruby
kcampen/Ruby
/blackjack2.rb
UTF-8
432
3.859375
4
[]
no_license
base_card = rand(10) puts "Your number is #{base_card}" puts "Continue?" answer = gets.chomp my_cards = [base_card] while answer == "yes" next_card = rand(10) my_cards.push(next_card) puts "Next card is #{next_card}" sum = 0 my_cards.each { |card| sum += card } puts "Your total card sum is #{sum}" if sum == ...
true
ecdd514e727d2f9b0d2173c98cc544d6fd3d73fa
Ruby
eclubb/RCAP
/lib/extensions/string.rb
UTF-8
335
2.875
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
class String # :nodoc: CAP_LIST_REGEX = Regexp.new( '"([\w\s]+)"|(\S+)' ) WHITESPACE_REGEX = Regexp.new('^\s+$') def for_cap_list if self =~ /\s/ '"'+self+'"' else self end end def unpack_cap_list self.split( CAP_LIST_REGEX ).reject{ |match| match == "" || match =~ WHITESPACE_REG...
true
65d17b28f7c98bd46d0f4258f5e0549ccd4ed719
Ruby
jr1412594/ruby-check
/mod_lesson/olympic_medal.rb
UTF-8
796
3.796875
4
[]
no_license
class OlympicMedal # below moduel included gives the class access to # <, <=, >, >=, ==, .between? include Comparable attr_reader :type MEDAL_VALUES = { "Gold" => 3, "Silver" => 2, "Bronze" => 1 } def initialize(type, weight) @type = type @weight...
true