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
e7a48f4102054c7bb2975c551c988851d86eca23
Ruby
JilvanJr/qafullstack
/ruby/capy/spec/tabelas_spec.rb
UTF-8
2,038
2.890625
3
[]
no_license
describe 'Tabelas', :tabs do before(:each) do visit 'tables' end it 'deve exibir o salario do stark' do atores = all('table tbody tr') # vai percorrer por todos os 'trs' (contém 5) e gravar na variavel stark a tr que contém o texto stark = atores.detect { |ator| ator.te...
true
8e78048b467fbb21539870c31e3cef7c2b799aa8
Ruby
dvandersluis/tdd-presentation-source
/spec/models/account_spec.rb
UTF-8
1,680
3.015625
3
[]
no_license
require 'spec_helper' describe Account do let(:user) { User.make! } let(:account) { Account.make(:user => user) } describe "#deposit" do it "should add the deposit amount to the balance" do account.deposit(50.0) account.balance.should == 150.0 end end describe "#withdraw" do it ...
true
f977aea0e06e18f4356805c0c4a9cbc97e57b410
Ruby
takatoh/filestorage-s3
/lib/filestorage-s3/amazon_s3.rb
UTF-8
1,259
2.703125
3
[ "MIT" ]
permissive
# encoding: utf-8 require 'filestorage' require 'aws' module Filestorage class AmazonS3 def initialize(bucket, access_key_id, secret_access_key) @s3 = AWS::S3.new(:access_key_id => access_key_id, :secret_access_key => secret_access_key) @bucket = @s3.buckets[bucket] ...
true
37713db9344a03d5fbf41b44a5c9cf000212dde9
Ruby
ChesterHub/phase-0-tracks
/ruby/iteration.rb
UTF-8
798
4.28125
4
[]
no_license
def yolo puts "pick a color." color = gets.chomp yield(color) end yolo { |color| puts "My favorite color is #{color}!" } num = [1,2,3,4] num.each do |numbers| p numbers end bers = [1,2,3,4] bers.map! do |number| p number.next end hashbers = {1 => 2,2 => 3,3 => 4,4 => 5} hashbers.map do |...
true
9eb1469b0903cc3867e851adc85eefedc0eea53f
Ruby
ninesky00/Night_writer
/test/english_write_test.rb
UTF-8
2,513
3.21875
3
[]
no_license
require_relative 'test_helper' class EnglishWriteTest < MiniTest::Test def setup @file1 = "./sample_text/hello_world.txt" @file2 = "./sample_text/br_hello.txt" @file3 = "./sample_text/br_long_string.txt" @file4 = "./sample_text/br_longest_string.txt" @english_write = EnglishWrite.new(@file1) ...
true
3ac18638d999d2a7f937d369e81ba14d9639a721
Ruby
pblaggan/hw3-acceptance-unit-test-cycle-master
/rottenpotatoes/features/step_definitions/movie_steps.rb
UTF-8
1,184
2.859375
3
[]
no_license
Given /the following movies exist/ do |movies_table| movies_table.hashes.each do |movie| # each returned element will be a hash whose key is the table header. # you should arrange to add that movie to the database here. # hint: look at movies_controller#create for a hint toward the one-line solution. Mo...
true
4d36768ee415348ed6f085319a3de23c76f7f813
Ruby
lausan029/E7CP1A1
/ej2.rb
UTF-8
295
2.96875
3
[]
no_license
productos = {'bebida' => 850, 'chocolate' => 1200, 'galletas' => 900, 'leche' => 750} productos.each { |valor, producto| puts producto } productos['cereal'] = 2200 productos['bebida'] = 2000 p productos new_productos = productos.to_a p new_productos productos.delete('galletas') p productos
true
70697e848ce3ca5dd71753e32e655a9d97d44f77
Ruby
karinamzalez/little_shop
/app/models/cart.rb
UTF-8
1,196
3.25
3
[]
no_license
class Cart attr_accessor :contents def initialize(initial_contents) @contents = initial_contents || {} end def add_cart_item(supply_item_id, quantity) contents[supply_item_id.to_s] ||= 0 contents[supply_item_id.to_s] += quantity.to_i end def delete_cart_item(supply_item_id) contents.delet...
true
c3def2219a11d8a93958023a845bfc2bc640a1bc
Ruby
c4lliope/cse841-flightfinder
/test/route_test.rb
UTF-8
2,488
3.25
3
[]
no_license
require 'minitest/autorun' require_relative '../lib/route' describe Route do describe '#new' do it 'takes a list of flights' do Route.new flights end end describe '#cities' do it 'returns the list of cities' do route.cities.must_equal cities end end describe '#cost' do it 'c...
true
eef73c6cd20daaf3355cd3f97d8599aa6e3348fe
Ruby
hangmanandhide/PITB-Minesweeper
/minesweeper.rb
UTF-8
3,472
3.734375
4
[]
no_license
require_relative 'board' require 'byebug' require 'yaml' class Minesweeper GAME_MODES = { 'easy' => [9, 10], 'medium' => [16, 40], 'hard' => [30, 145], 'uuddlrlrba' => [9, 1], } def self.setup system("clear") puts "Welcome to Minesweeper! Please choose from the following:" mode ...
true
ecfc5fb193907784a91c41bbeffaff40f0d767b0
Ruby
lacuitino/examen_ruby1
/examen.rb
UTF-8
3,117
3.296875
3
[]
no_license
def opcion1 #ESTA ES LA FORMA ORIGINAL EN QUE YO LO PENSÉ E HICE, LUEGO ME DI CUENTA QUE HABIA una #FORMA QUE AHORRA BASTANTES LINEAS DE CODIGO. PERO MANTUVE LA FORMA ORIGINAL #AQUI ABRO EL ARCHIVO Y LO GUARDO LAS LINEAS EN UN ARREGLO DATA file = File.open('alumnos.csv','r') data = file.readlines.map { |e| e...
true
6276fa405d3561baec3b218007c124ad90c3988f
Ruby
alanshields/watir
/watir/unittests/element_test.rb
UTF-8
1,731
2.640625
3
[]
no_license
# feature tests for element and the elements collection # revision: $Revision$ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED require 'unittests/setup' class TC_Elements < Test::Unit::TestCase include Watir::Exception def setup uses_page "div.html" end def test_eleme...
true
230354c012f94fae19833eaefce48811f2a14ce3
Ruby
mjainchell/survivr_1
/app.rb
UTF-8
92
2.609375
3
[]
no_license
require 'colorizr.rb' p String.colors puts String.sample_colors puts 'Hello World!'.red
true
b7a85e6144e820750be5a7fedf515775bfdb4ef2
Ruby
roryokane/build-it-break-it-fix-it-contest-fall-2014
/build/src/header.rb
UTF-8
381
2.65625
3
[]
no_license
#!/usr/bin/env ruby require 'pp' # Hello breakers! Lucky you, I wrote this program in Ruby to save on developer time. Thus, you get to read my source code to look for flaws. # Of course, I have accounted for that, and written the program such that that shouldn’t make a difference. I have included no private keys or s...
true
82f0d1440cc7f393e59605b950ffd2e5a77a7a43
Ruby
melvynator/string_compressor
/short_string_packer.rb
UTF-8
952
3.75
4
[]
no_license
class ShortStringPacker ## Packs a short string into a Fixnum # Arguments: # str - String object # Returns: a Fixnum object def self.pack(str) packed_value = "1" str.each_char do |char| five_bits_char = format('%05d', (char.ord - 'a'.ord).to_s(2) % 100000 ) packed_value += five_bits_char...
true
9ccdee9d422e8c3d016e5f9ed8b4a321c0de0822
Ruby
dtao/Objective-LINQ
/lib/ns_type.rb
UTF-8
251
2.5625
3
[]
no_license
require File.join(File.dirname(__FILE__), "type") class NSType < Type class << self def all if @all.nil? @all = %w{String Value Number}.map { |w| NSType.new(w) } end @all end end def prefix "NS" end end
true
982d8d1389e97a7ef5d46c7fa59457331de495f8
Ruby
uk-gov-mirror/DFE-Digital.accessibility-scanner
/ruby/a11y-test.rb
UTF-8
1,052
2.578125
3
[]
no_license
require 'json' require_relative 'a11y-modes' require 'colorize' require 'logger' def run_a11y( log , original , url ) status = false j = IO.popen("pa11y -c pa11y.config.json --reporter json #{url}" ).read() begin data = JSON.parse(j) puts( "#{original} \n".green ) dat...
true
6a11aa99c130e16fde0df702dc924c5c482250cd
Ruby
Lewington-pitsos/launch_excercises
/small_problems/excercise_3/q8.rb
UTF-8
562
3.90625
4
[]
no_license
#OOOOOOOOOOOOOOOOOOOPS, i thought this was somethung else entirely (more fun :( ) def palfinder str #I'm relying on the fact that when you devide intigers by intigers the result #will always round down. regardless of whether the string is an even or odd #length, half1 must match A REVERSED VERSION OF half2 ...
true
083b912f41c988613e3a46320b2db0da2fc7a4b5
Ruby
FrankyMessi/FreeDocApp
/db/seeds.rb
UTF-8
1,422
2.578125
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
true
c8ad13681c1da4a76390d4a2e5df1ceafc4d27df
Ruby
nicoolas25/advent-of-code-2018-ruby
/08/part1.rb
UTF-8
600
3.03125
3
[]
no_license
# frozen_string_literal: true integer_stream = ARGF .each_char .lazy .chunk_while { |_, after| after != ' ' } .map { |numbers| numbers.join.to_i } .to_enum Node = Struct.new(:children, :metadata) do def self.read_from(stream) child_node_count = stream.next metadata_count = stream.next childre...
true
666b033e7828172c724f517bb95501df53df2348
Ruby
antonsokolskyy/Ruby-Algorithms
/search/binary_search.rb
UTF-8
1,208
3.625
4
[]
no_license
# Binary search. O(log n) # user system total real # Found! Index is 911575 # 0.000000 0.000000 0.000000 ( 0.000035) Iterative (With index) # Found # 0.000000 0.000000 0.000000 ( 0.000033) Recursive (Without index) require 'benchmark' @sorted_array = Array.new(1_000_000) { rand(1....
true
01c99455e45e36a779f76a2e2711e370410514bb
Ruby
nadavP3/TicTacToe
/game.rb
UTF-8
536
2.953125
3
[]
no_license
# This is the runner file. require_relative 'board' require_relative 'player' require_relative 'computer' require_relative 'view' require_relative 'pvp' require_relative 'pve' include Computer include Pvp include Pve main_menu game_mode = gets.chomp while (game_mode != "c" && game_mode != "p") main_menu puts "Bad i...
true
81dfbd726a39aeb6db430d61917d53aeeeae9107
Ruby
stevegoobermanhill/ruby_trie
/lib/ruby_trie.rb
UTF-8
4,742
3.25
3
[ "MIT" ]
permissive
# ruby_trie # a pure Ruby trie implementation # because fast-trie is broken and segfaults # Stephen Gooberman-Hill@amey.co.uk # (c) Amey Nov 2016 # licenced uner the MIT licence gem 'tree' require 'tree' # RubyTrie is a pure Ruby implentation of a Trie based on the # Tree module module RubyTrie # the content of...
true
33531cd53b554fbaff1524ebe511ce4981c9e52a
Ruby
yaoyizhi/programming-exercise
/21-selection-sort.rb
UTF-8
704
4.15625
4
[]
no_license
# 给定一数组内含数字,请实作选择排序法进行排序。 # https://zh.wikipedia.org/wiki/选择排序 # def selection_sort(arr) 这是错误的写法 # arr_new = [] # arr.each_with_index do |i| # arr_new << arr.min if arr.min = i # end # arr_new # end def selection_sort(arr) # 这个写法不理解 (0..arr.length - 1).each do |i| min = arr[i] index = i (i + 1..arr.leng...
true
c7a699239e40ddb639a0322261ad6469124d8a64
Ruby
mahendrakg1/Ruby-assignments
/p1.rb
UTF-8
1,067
3.171875
3
[]
no_license
puts "ENTER THE NAME OF FILE TO BE CREATED" fileName=gets fileName = fileName.chomp while(1) puts "enter the no of lines" numberOfLines=gets; numberOfLines=numberOfLines.to_i if(numberOfLines<10) puts "enter line no greater that 10" else break end end begin fd=nil if(fileName.empty?) raise "entered filename ...
true
9430dde048a6a46185094fbb5ea688fa956502eb
Ruby
jayfajardo/openlibrary
/lib/openlibrary/client/search.rb
UTF-8
786
2.59375
3
[ "CC0-1.0" ]
permissive
module Openlibrary module Search # Access the Openlibrary free-text search. # This API is experimental but useful (http://openlibrary.org/dev/docs/api/search) # This implementation only supports the first 100 results for simplicity # Possible search parameter keys include # :q (cross-field query)...
true
ec0353cc124174a4268f55b09ea1bb6620c5da4b
Ruby
thumphrey3/BEWD_SF_5_homework
/TolisonHumphrey-thump/midterm/Swift_Foot/main.rb
UTF-8
551
3.015625
3
[]
no_license
require_relative 'lib/manko_pei' puts 'Welcome to SwiftFoot! Where we help you select the best upcoming fitness event based on your lifestyle.' puts 'What is your name (First & Last Name)?' user_name = gets.chomp puts 'What is your age?' user_age = gets.chomp puts 'What is your gender(M/F)?' user_sex = gets.chomp p...
true
ecb38203b73e95c83547e13d90c4d9cc26a74370
Ruby
qiannyqian/ruby_exercises
/anagrams_2.rb
UTF-8
424
3.515625
4
[]
no_license
def canonical(word) word.downcase! word.split(//) end def anagrams_for(word, dictionary) x = canonical(word) anagrams = [] dictionary.each do |y| if (canonical(y)-x).empty? anagrams << y end end p anagrams end dictionary = ["acres", "cares", "Cesar", "races", "smelt", "melts", "etlsm"]...
true
52a0e63a2dd10bd83e179469e458494a54719664
Ruby
AZatsepa/first_cli
/lib/first_cli/cli.rb
UTF-8
1,064
3.484375
3
[]
no_license
require 'colorize' require 'readline' module TravelInspiration class CLI def start list_commands end def list_themes puts "Hello! Which travel inspiration will you like to explore for your next trip?".green.bold puts "\nPlease select a theme from 1 - 12...
true
bd59db6cf6066466bc4b5dfcf69e047c492b5ef8
Ruby
karrakis/fenrir
/lib/plaintext_deconstructor/phrase_maker.rb
UTF-8
137
2.90625
3
[]
no_license
class Alltext attr_accessor :paragraphs def initialize(string) @fulltext = string @paragraphs = string.split(/\n\t/) end end
true
b23fd0a348ce6a49f3b072f409742fdcd3e95e82
Ruby
RavensKrag/ThoughtTrace
/lib/ThoughtTrace/input_system/button_event.rb
UTF-8
1,587
3.078125
3
[]
no_license
module InputSystem class ButtonEvent attr_reader :name, :keys, :modifiers def initialize(name, callbacks) @name = name @callbacks = callbacks # provides these methods: initialize, press, hold, release, cancel @keys = nil @modifiers = nil end # TODO: consider removing Binding class. It's kinda an un...
true
90d2245ece209a0521dfe85e390ed90af9b0c27d
Ruby
aromatt/pushfour
/lib/strategy.rb
UTF-8
1,081
2.875
3
[]
no_license
require_relative 'board' module PushFour class Strategy attr_accessor :board, :player attr_reader :timing def initialize(board, player) fail unless board && player @board = board @player = player @timing = {} end # Returns all positions in win paths for both players ...
true
7f6a42c41d8ccdf31c7763af0e7d993eec6a60bb
Ruby
etki/satellite.etki.me
/cookbooks/satellite.etki.me/libraries/hashes.rb
UTF-8
855
2.828125
3
[ "UPL-1.0", "MIT" ]
permissive
module Etki module Satellite module Hashes class << self def get(hash, *keys) keys.map { |key| hash[key.to_sym] || hash[key.to_s] } end def fetch(hash, *keys) keys.map { |key| hash.fetch(key.to_sym) || hash.fetch(key.to_s) } end def key?(hash, ke...
true
004696ed4a69c7d5533760acf6fd93bcb782b9a9
Ruby
matthewsedlacek/programming-univbasics-nds-nested-arrays-iteration-lab-part-2-sea01-seng-ft-042020
/lib/iteration_with_loops.rb
UTF-8
538
3.375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def find_min_in_nested_arrays(src) # src will be an array of arrays of integers # Produce a new Array that contains the smallest number of each of the nested arrays low_temp_array = [] row_index = 0 while row_index < src.length do element_index = 0 lowest_temp = 10000 while element_index < src[row_index].leng...
true
37b8b406abcc61638d87ffecd9dbab0b2f9d5aaf
Ruby
curi1119/sample-websock-server-using-celluloid
/cell_server.rb
UTF-8
2,888
2.703125
3
[]
no_license
require 'reel' require 'celluloid/autostart' require 'pry' class SockHandler include Celluloid include Celluloid::Notifications def initialize(ins, ws) @instance = ins @socket = ws @socket.on_message{|msg| on_message(msg) } @socket.on_close{ on_close } async.run end def run loop do ...
true
10976a60e2de3869dd868917cc2215c0cd1e60fe
Ruby
LisaDuschek/Numbers_to_words
/spec/numbers_to_words_spec.rb
UTF-8
1,897
3.21875
3
[]
no_license
require ('rspec') require('numbers_to_words') describe('Fixnum#numbers_to_words')do it('converts one digit to written form')do expect(2.numbers_to_words()).to(eq('two')) end it('converts two digits to written form')do expect(99.numbers_to_words()).to(eq('ninety nine')) end it('converts two digits to...
true
1d2bcd566b98e454f5e31b5227f7451f56cf2432
Ruby
simcha/redis_eat_to_the_end_queue
/dequeue.rb
UTF-8
1,110
2.609375
3
[]
no_license
require "redis" require "json" redis = Redis.new TTL=10 start_time = Time.now threads = [] 2.times do |i| threads << Thread.new(i) do |client_uuid| while redis.eval("return #redis.call('keys', 'queue_of_*')") > 0 do queues = redis.keys("queue_of_*") time_now_f = Time.now.to_f ...
true
94960e5a0832d9e8d74d7e5a9ba7768f7bc0779a
Ruby
cycloped-io/cycloped-io
/category-mapping/test/spec/wikipedia_name_converter.rb
UTF-8
1,313
2.765625
3
[]
no_license
require 'bundler/setup' $:.unshift "lib" require 'mapping/wikipedia_name_converter' module Mapping describe WikipediaNameConverter do subject { WikipediaNameConverter.new(name) } let(:name) { "People" } context "conversion to Cyc" do it "should convert to Cyc names" do subjec...
true
d7e02d26f08eaff0d80c4906583cdfa660951271
Ruby
RaphaelPour/advent-of-code
/15/day14/part2.rb
UTF-8
877
3.34375
3
[]
no_license
time = 2503 reindeers = STDIN.read.lines.map do |line| line.chomp! _, speed, ts, tr = line.scan(/^([A-Z]\w+) can fly (\d+) km\/s for (\d+) seconds, but then must rest for (\d+) seconds.$/).first {speed: speed.to_i, ts: ts.to_i, tr: tr.to_i, dist: 0, points: 0} end rank = time.times.map.inject(reindeers) do |d...
true
315fccb7feae393cc62a1fc4ec7735e6553eb4ac
Ruby
Anikram/weather
/forecast.rb
UTF-8
3,247
3.203125
3
[]
no_license
#encoding: utf-8 #класс прогноза require 'net/http' require 'uri' require 'rexml/document' class Forecast def self.cities {'Москва' => 'https://xml.meteoservice.ru/export/gismeteo/point/37.xml', 'Санкт-Петербург' => 'https://xml.meteoservice.ru/export/gismeteo/point/69.xml', 'Таганрог' => 'https://x...
true
a29ef4ad223ca1e21fc4e01c9db50441485e98bf
Ruby
Zrp200/robotic_movement
/lib/robotic_movement.rb
UTF-8
152
2.546875
3
[ "MIT" ]
permissive
class Robot def initialize x, y = 0, 0 def scan(coord) if x + 1 = 100 and y + 1 = 100 return -1 elsif x + 1
true
a77019ee2c93ba99f9f9ad07f61a36f7838c97ad
Ruby
kumarsaurabh20/bioaqua1
/app/models/person.rb
UTF-8
568
2.5625
3
[]
no_license
class Person < ActiveRecord::Base validates_presence_of :firstname, :lastname, :email, :message => "Can't be empty, field is mandatory. " EmailRegex = /\A[\w+\-._]+@[a-z\d\-.]+\.[a-z]+\z/i validates_format_of :email, :with => EmailRegex validates_uniqueness_of :email, :case_sensitive => false belongs_to :...
true
11da766a059fe6b639b1fc1f872e72aa10dbb108
Ruby
cielavenir/procon
/hackerrank/oracle3_fake.rb
UTF-8
303
2.515625
3
[ "0BSD" ]
permissive
#!/usr/bin/ruby n,p,l,k,utmost=gets.split.map(&:to_i) cnt=gets.to_i raise if n%2==1 a=$<.map(&:chomp) maj=Array.new(k){[]};maj[0]=[0] a.each{|e| b=e.split if b[2]=='YES' maj[0]<<b[1].to_i else maj[1]<<b[1].to_i end } if r=maj.find{|e|e.size>=n-1} puts r.first else puts "0 "+(cnt/2+1).to_s end
true
61e8c748be20463956b3f2bd16d1f417a4aa5472
Ruby
Mar5Planet/simplesh-api
/db/seeds.rb
UTF-8
765
3.03125
3
[]
no_license
require 'faker' # Faker::Quotes::Shakespeare.hamlet_quote # => "To be, or not to be: that is the question." # Faker::Quotes::Shakespeare.as_you_like_it_quote # => "Can one desire too much of a good thing?." # Faker::Quotes::Shakespeare.king_richard_iii_quote # => "Now is the winter of our discontent." # Faker::Quot...
true
f79ff4f9b6a44189e135e3bd9514f1b5748e55a0
Ruby
pnikrat/dictapi
/model/trie_node.rb
UTF-8
1,844
3.359375
3
[]
no_license
# Single trie node. May contain value - pronounciation of the word class TrieNode attr_reader :key, :value attr_accessor :suggestions def initialize(char) @key = char @children = [] @value = nil end def insert(word, value) return second_pronounciation(value) if word[0] == '(' next_node = ...
true
ca74710e7e8c1b81153f6df95178287e6bb2d0d4
Ruby
gautamworah96/CSC517OODD
/book.rb
UTF-8
1,549
4.125
4
[]
no_license
class Book attr_reader :name, :price # creates getter methods attr_writer :name, :price # creates the setter methods def initialize(name, price) @name = name raise ArgumentError.new("Name empty") if (@name.nil? || @name == '') @price = price raise ArgumentError.new("Price is either negative or zero") if (@p...
true
13421d914577747db4329aee41af769153548748
Ruby
trystan/lifegrid
/genotype.rb
UTF-8
780
3.671875
4
[]
no_license
class Genotype attr_reader :color, :growth def initialize parent = nil if parent @color = parent.color.clone @growth = parent.growth.clone else @color = [rand(64)+32, rand(64)+32, rand(64)+32] @growth = Array.new(9) { 0 } 9.times { @growth[rand(9)] += 1 } end end def...
true
7faf0219fb2bff74aae396619d5dc9b7d5eb4383
Ruby
josh-sea/oo-counting-sentences-nyc-web-111918
/lib/count_sentences.rb
UTF-8
1,013
4.28125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class String def sentence? #binding.pry #pry shows the string name to be the self value self.end_with?(".") end def question? self.end_with?("?") end def exclamation? self.end_with?("!") end def count_sentences #binding.pry #loop through the string being test...
true
41ceb2968e0d15a3a8bbf9346276fc6e9e5dcbaf
Ruby
nico-hn/PseudoHikiParser
/test/test_blockparser.rb
UTF-8
11,231
2.796875
3
[ "BSD-2-Clause" ]
permissive
#/usr/bin/env ruby require 'minitest/autorun' require 'lib/pseudohiki/blockparser' class TC_BlockLeaf < MiniTest::Unit::TestCase include PseudoHiki::BlockParser::BlockElement def test_block_when_descnode assert_equal(DescNode, DescLeaf.new.block) end def test_block_when_headingleaf assert_equal(Head...
true
0d17826266e4eb9fac5760055cd01ee0a5b9baa9
Ruby
AlexanderOsborne/books_books_books
/lib/library.rb
UTF-8
428
3.4375
3
[]
no_license
class Library attr_reader :name, :books, :authors def initialize(name) @name = name @books = [] @authors = [] end def add_author(author) @authors << author @books << author.books # require 'pry'; binding.pry r...
true
e17f4f69c9459a1cd741297b95d7855fac6c1b76
Ruby
ianquixote/rb100_exercises
/hashes/iterating_over_hashes.rb
UTF-8
148
3.296875
3
[]
no_license
person = {name: 'Bob', height: '6 feet', weight: '160 lbs', hair_color: 'brown'} person.each do |key, value| puts "Bob's #{key} is #{value}." end
true
36c2fb8e68d6550e61a53ab977c6d287a56041ab
Ruby
Mattia46/learn_to_program
/ch11-reading-and-writing/safer_picture_downloading.rb
UTF-8
531
3.03125
3
[]
no_license
Dir.chdir('/Users/mattia/Desktop/txt_files') puts Dir.pwd foto = Dir["/Users/mattia/Desktop/*.txt"] puts "come vuoi chiamarla?" nome_foto = gets.chomp puts "downloading #{foto.length} files: " counter = 1 foto.each do |name| print "." new_name = if counter < 10 "#{nome_foto}0#{counter}.txt" else ...
true
ff1f1b471f931194bd49476b96d08cc9e32c21c3
Ruby
busteraph/delivery_router
/lib/order.rb
UTF-8
189
2.671875
3
[]
no_license
class Order attr_accessor :id, :restaurant, :customer, :state def initialize(p) self.customer = p[:customer] self.restaurant = p[:restaurant] self.state = "new" end end
true
840d575b2344c3f9eccf7b3aca9e318ad5b66270
Ruby
timeemit/sphr
/app/models/echo.rb
UTF-8
3,865
2.8125
3
[]
no_license
#Other users can echo a shoutout into a ring of their choice, where they share the original author's shoutout with their own friends. #Echoes can be further echoed through vibrations. #An echo keeps track of it's distance from the original shoutout #On creation, an echo needs # a shoutout_id #and can also take # a vi...
true
bae23d504ef9ef375936274b55913b71169cf704
Ruby
patrykptak23/learn_ruby
/05_book_titles/book.rb
UTF-8
681
3.59375
4
[]
no_license
class Book # write your code here attr_accessor :title def initialize end def title=(title) exceptions = ["a", "the", "and", "an", "in", "and", "of"] title_words = title.split title_words.length.times do |i| if((i != 0)...
true
8928cc20c3a4c4c1fc5727143c8887eebe9e229f
Ruby
MiyamotoAkira/CommandLineGames
/tests/strategy/computer_base_tests.rb
UTF-8
743
2.640625
3
[]
no_license
#!/usr/bin/env ruby gem 'minitest', '>= 5.0.0' require_relative '../test_helper' require_relative '../../lib/strategy/computer_base' class ComputerBaseTest < Minitest::Test def test_check_possible_score_none_available_should_return_nil mock = Minitest::Mock.new mock.expect(:get_available_spaces, ["1","3","5"...
true
415e5bb5403436fd57ee9d1b57e15d6bd467e8f3
Ruby
JulesRoadknight/Bookmark-Manager
/spec/bookmark_spec.rb
UTF-8
921
2.671875
3
[]
no_license
require 'bookmark' describe Bookmark do let(:url) { "https://google.com" } let(:title) { "Google" } let(:id) {4} let(:bookmark) { Bookmark.new(url, title, id) } it "returns a link" do expect(bookmark.url).to eq(url) end it "returns a name" do expect(bookmark.title).to eq(title) end # it '...
true
a3c35b9f3665db86fd4fbf21437352cd36b20551
Ruby
86gumball/Exercism
/ruby/series/series.rb
UTF-8
288
3.515625
4
[]
no_license
class Series attr_reader :str def initialize(s) @str = s end def slices(n) throw :ArgumentError if n > @str.length solve = Array.new fst = 0 while fst + n - 1 < @str.length solve << @str.slice(fst, n) fst += 1 end return solve end end
true
2fd541927419f3cf4954fcc51182a84f5443faa3
Ruby
curious/em-rtmp
/lib/em-rtmp/buffer.rb
UTF-8
701
2.890625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require "stringio" require "em-rtmp/io_helpers" module EventMachine module RTMP class Buffer < StringIO include EventMachine::RTMP::IOHelpers # Gets the number of remaining bytes in the buffer # # Returns an Integer representing the number of bytes left def remaining length...
true
08548780b01286cc831dd345cd56e4994a161468
Ruby
cloudfoundry/java-buildpack
/lib/java_buildpack/util/colorize.rb
UTF-8
3,468
2.8125
3
[ "Apache-2.0" ]
permissive
# frozen_string_literal: true # Cloud Foundry Java Buildpack # Copyright 2013-2020 the original author or authors. # # 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....
true
45937c73d15f3414ea3066d37c518be028f015b8
Ruby
kumu/headcount
/lib/headcount/configuration.rb
UTF-8
1,648
2.515625
3
[ "MIT" ]
permissive
module Headcount @@config = nil class << self def settings @@config ||= Configuration::Base.new end def configure(&block) settings.evaluate(&block) end private def persistence_handler # eventually might want to support others Headcount::Persistence::File....
true
0fd1579751dec2be0527e7e4f983f978779732cd
Ruby
tiagoamaro/pickpocket
/lib/pickpocket/articles/library.rb
UTF-8
2,214
2.859375
3
[ "MIT" ]
permissive
require 'fileutils' require 'yaml/store' module Pickpocket module Articles class Library attr_accessor :logger attr_reader :store, :api private def yaml_store FileUtils.mkdir_p(File.dirname(Pickpocket.config.library_file)) YAML::Store.new(Pickpocket.config.library_file) e...
true
125e44f0ca6a8ecaa616f007511c6fd2752f748a
Ruby
va1t/paeon
/lib/claim_status.rb
UTF-8
1,395
3.09375
3
[]
no_license
# # In processing the 835, there is a claim status indicator # in the eob table, this claim status indicator is stored. # This class stores the various indicator codes as constants and returns the definiton # class ClaimStatus #these are the 835 status that are not marked "not advised" PRIMARY = 1 SECONDARY...
true
7f3bc84eaaf94333d5dbf37d6465aac0fdf4517d
Ruby
SpiderEvgn/jbz4
/app/helpers/application_helper.rb
UTF-8
1,183
3.28125
3
[]
no_license
module ApplicationHelper def to_money(amount) number_to_currency(amount, unit: "¥") end # 如果传入的字符串用|分隔且没有空格时,可用这个helper来重新生成一段有空格的string。 def divide_text(text) result = [] text.split('|').each do |w| result << w.strip end return result.join(' | ') end def get_stars(grade) g ...
true
678d364d1ab8c5a7bd4b367f01015a938e68e416
Ruby
Idayat8703/news-trending-cli-app
/lib/news_trending/CLI.rb
UTF-8
1,677
3.203125
3
[ "MIT" ]
permissive
class NewsTrending::CLI def call NewsTrending::Scraper.scrape_articles list_top_articles puts "---------------------------------" main_menu end def list_top_articles #shows a list of all the Trending news for the day using the instance of article puts "-----------------------------...
true
9080d596a0a3196243168ed217a58bfadac2a6e7
Ruby
kevinquach/interview_practice
/isbn.rb
UTF-8
530
2.796875
3
[]
no_license
LIMIT = 1.0 / 0 # This is equivalent to infinity %w{rubygems time redis}.each{|r| require r} $redis = Redis.new(:host => "127.0.0.1", :port => 6379) $redis.flushall count, start = 0, Time.now File.open(ARGV[0]).each do |line| count += 1 next if count == 1 isbn, _, _, title = line.split("\t") next if isbn.empty...
true
fbb34a330b6b06115670e0e2cf06ef708f69f3cd
Ruby
qisantanu/parser
/lib/parser.rb
UTF-8
677
2.640625
3
[]
no_license
require "parser/version" require 'nokogiri' require 'open-uri' module Parser class Error < StandardError; end class Html def initialize(url) begin @doc = Nokogiri::HTML(URI.open(url)) rescue "Invalid URL" end end def fetch_title @doc.title end def fetc...
true
509b68679ffb67c2447a47d8a58f7530cfe22b3c
Ruby
ChefAustin/chef-web-docs
/doctools/lint_nav_check
UTF-8
1,784
3.140625
3
[ "CC-BY-3.0" ]
permissive
#!/usr/bin/env ruby # This script checks if the topic is present in the left-nav and on the index page (i.e. the sitemap). NAVREGEX = /\"url\": \"\/(\S+).html.*\"/ RELREGEX = /<\/(\S+)>/ ABSREGEX = /<https:\/\/docs\.chef\.io\/(\S+).html#\S+>/ @files = [] def list_entries(file, regexoptions = {}) # Output all mat...
true
cdcb2c49147c9fe7b5cde7667f22c756930b231a
Ruby
wied03/ansible-ruby
/lib/ansible/ruby/modules/generated/cloud/amazon/ec2_vpc_dhcp_option.rb
UTF-8
4,178
2.5625
3
[ "BSD-2-Clause" ]
permissive
# frozen_string_literal: true # See LICENSE.txt at root of repository # GENERATED FILE - DO NOT EDIT!! require 'ansible/ruby/modules/base' module Ansible module Ruby module Modules # This module removes, or creates DHCP option sets, and can associate them to a VPC. Optionally, a new DHCP Options set can be...
true
00b0f8d0d382ac754a301c06c2682d3adf0a260d
Ruby
kkk987/Hangman
/src/class/leaderboard.rb
UTF-8
1,222
3.3125
3
[]
no_license
# Hangman - leaderboard module # Created on 05/05/2019 # This file includes methods relaated to leaderboard # It supports functionalities like: # - display the leaderboard # - load the existing leaderboard # - create a new leaderborad # - save the ranks require 'terminal-table' require 'yaml' modu...
true
c6312ac6ed0154d7fbf6a6c97a1fb2037677b4a5
Ruby
kealanheena/battle
/spec/status_spec.rb
UTF-8
1,584
3.15625
3
[]
no_license
require 'status' describe Status do let(:status) { Status.new } describe '#add' do it 'should add a status to the current array' do expect(status.add('poisoned')).to eq ['poisoned'] end it 'should add different statuses to the current array' do expect(status.add('immobilised')).to eq ['i...
true
419a916bf08e35cb252c6765552dd60846f1a5e3
Ruby
tmccartan/Ruby
/Patterns/Abstract Factory with Singleton/Products/deadly_product_b.rb
UTF-8
129
2.796875
3
[]
no_license
require_relative 'product_b.rb' class DeadlyProductB<ProductB def do_it puts "I'm a #{self.class.name}, doing it" end end
true
8541b62ce7ce749e93bec6d63d63e12b3c09e93f
Ruby
snowman7281/title_case
/spec/title_case_spec.rb
UTF-8
337
3
3
[]
no_license
require('rspec') require('title_case') require('pry') describe('#title_case') do it("returns input with the first letter capitalized") do expect(("toy").title_case).to(eq("Toy")) end it("capitalizes the first letter of all words in a multiple word title") do expect(("toy story").title_case).to(eq("Toy St...
true
25ca231373c91180ef24e2b104f45df28dc4ef98
Ruby
tozhang665/aa_homework
/W5D3/practice.rb
UTF-8
1,660
4.65625
5
[]
no_license
# You are climbing a stair case. It takes n steps to reach to the top. # Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? # Note: Given n will be a positive integer. # Example 1: def stairs(num) steps = [1, 2] arr = [Array.new(num,1)] end #function intake...
true
6ffa2fefe74a6d0d3651aeb8fe82ff76650f4710
Ruby
nerd2ninja/atlas-ruby
/examples/Chatroom/main.rb
UTF-8
3,803
2.53125
3
[ "MIT" ]
permissive
=begin MIT License Copyright (c) 2018 Claude SIMON (https://q37.info/s/rmnmqd49) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the right...
true
9432bddf23b3ad675d78eac25c5cf44a70fef094
Ruby
hanloong/auto-mower
/spec/controllers/lawn_controller_spec.rb
UTF-8
4,201
2.515625
3
[]
no_license
require 'rails_helper' describe LawnController, type: :controller do describe '#create' do it 'should create a new lawn' do expect do post :create, { width: '5', height: '5' } end.to change { Lawn.count }.by(1) expect(Lawn.last.width).to eq 5 expect(Lawn.last.height).to eq 5 e...
true
257c72d7d7297b7efc7d52810a9f055945e6bbfc
Ruby
michellemoon236/ruby-objects-has-many-lab-online-web-ft-041519
/lib/author.rb
UTF-8
413
3.078125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Author attr_accessor :name def initialize(name) @name = name @posts = [] end def posts @posts end def add_post(one_post) @posts << one_post one_post.author = self end def add_post_by_title(post_title) one_post = Post.new(post_title) @posts << one_po...
true
646faf4128ffc7d07bbb10837a644ad6a28fe6e3
Ruby
kyokutyo/arabic_numeral2japanese_numeral
/test/test_arabic_numeral2japanese_numeral.rb
UTF-8
736
2.734375
3
[]
no_license
require 'test_helper' class TestArabicNumeral2JapaneseNumeral < MiniTest::Unit::TestCase include ArabicNumeral2JapaneseNumeral def test_not_convert assert_equal arabic_numeral2japanese_numeral("foo"), "foo" end def test_123_convert assert_equal arabic_numeral2japanese_numeral("123"), "一二三" end def ...
true
397d1887f9acb4412d048120e091f72e5aca9022
Ruby
nikolagolux/basejump
/app/models/event.rb
UTF-8
714
2.53125
3
[]
no_license
# == Schema Information # # Table name: events # # id :integer not null, primary key # title :string not null # description :text # author_id :integer not null # project_id :integer not null # start_date :string not null # end_date :string ...
true
f2a33d1bd1e1b320f175a4f8123d79b21a5e7f7e
Ruby
KevinKansanback/Launch_School_Backend_Prep-
/complete_excercises/loops_iterators/5.4.rb
UTF-8
157
3.234375
3
[]
no_license
def count_down(num_start) puts num_start if num_start >= 1 count_down(num_start - 1) end end count_down(25) count_down(12) count_down(-3)
true
ca993410373946afa5cb45529de88b6a55098f68
Ruby
agisga/small_tasks_rb
/file_management/reindex_subseq.rb
UTF-8
1,429
3.390625
3
[ "MIT" ]
permissive
# This script # (1) sorts .png files (e.g. "foo001.png", "foo002.png", ..., "foo99999.png") # according to their index, # (2) copies every n'th file into an output directory, # and (3) renames the output files in a successive order (such as "bar001.png", # "bar002.png", ..., "bar099.png"). # # Change these four li...
true
7afe406721529b32f7da3e94a41454cc4d3e5074
Ruby
Ishotihadus/Miotsukushi2
/Tools/KanColleLibEventGenerator/generator.rb
UTF-8
3,053
2.828125
3
[ "MS-PL", "Apache-2.0", "MIT" ]
permissive
# KanColleLib用イベント周りのジェネレータ # 入力データは以下のとおり # kcsapiurl,イベント名,リクエストクラス,レスポンスクラス # リクエストクラスは初期がTransmissionRequest.RequestBase # api_dataが必要でなければレスポンスクラスはobjectにする # 行頭が#で始まる行は無視する # イベント定義は以下 # /// <summary> # /// [kcsapiurl] を受信して解析に成功した際に呼び出されます # /// </summary> # public event Get[イベント名]EventHandler Get[イベント名]; # p...
true
93b9f872fbd1ab75704de23ab6d84c0570c51140
Ruby
juliabouv/sorting-string-manipulation
/lib/reverse_sentence.rb
UTF-8
784
4.0625
4
[]
no_license
# A method to reverse the words in a sentence, in place. # Time complexity: O(n) - linear complexity, will scale according to the growth of the array length # Space complexity: O(n) - linear complexity, an array is being created def reverse_sentence(my_sentence) return my_sentence if my_sentence.nil? || my_sentence.l...
true
a0d4ccb9d30c9406ac5d647285cc9b1f7948283d
Ruby
lkisabeth/latest-games-cli-gem
/lib/latest_games/ps4game.rb
UTF-8
1,598
2.765625
3
[ "MIT" ]
permissive
class LatestGames::PS4Game attr_accessor :name, :url, :summary, :release_date, :metascore, :publisher, :also_on def initialize(name = nil, url = nil) @name = name @url = url end def self.all @@all ||= scrape_ps4_games end def self.find(i) self.all[i-1] end def self.find_by_name(name)...
true
93cf24455adb83af4473854c1b48f5f9823da95d
Ruby
hftay/WDI_13_HOMEWORK
/Hsing Fu/wk04/3-wed/monkeys_lab/monkey.rb
UTF-8
903
4.125
4
[]
no_license
# Create a Monkey class in monkey.rb, which has the following attributes: # name - a string, which should be determined by some input # species - a string, which should be determined by some input # foods_eaten - an array, which should be initialized as an empty array # And the following methods: # eat(food) - adds a...
true
1ad918782a9751bd1e3d766bd685e0f95a988691
Ruby
mikel-codes/roundruby
/ANON/csv_stats/meth_stats/expr.rb
UTF-8
1,363
3.21875
3
[]
no_license
class ScoreKeeper def initialize @total_count = @count = 0 @project = [] end def <<(score) @total_count += score @count += 1 return self end def average fail "No scores" if @count.zero? return (Float(@total_count) / @count) + 0.5 end def []=(*params) value = params.pop ...
true
7944f8beb27682e826f44ea17625549aae046148
Ruby
dawid-sklodowski/progress
/lib/multipart_data.rb
UTF-8
1,038
2.640625
3
[ "MIT" ]
permissive
class MultipartData attr_accessor :name, :user_filename, :body def initialize(request) @request = request @headers = @file @body = '' @raw_headers = [] end def <<(line) if @headers @body << @line_to_write if @line_to_write @line_to_write = line elsif line == "\r\n" @he...
true
e7663e76691c3fb2e593a01e06acf28a27d586c4
Ruby
nagita280/ruby
/3.2.rb
UTF-8
219
3.65625
4
[]
no_license
puts "Enter the starting number:" num1 = gets num1 = num1.to_i puts "Enter the end number:" num2 = gets num2 = num2.to_i puts "divisble by 5 numbers are:" for i in num1..num2 if(i%5==0) puts i end end
true
fa79962043d6164d27a0215bf81089f0e3ad3aa3
Ruby
reinaldooli/saringan
/lib/saringan/operator.rb
UTF-8
484
2.734375
3
[ "MIT" ]
permissive
# frozen_string_literal: true # -*- encoding: utf-8 -*- require 'saringan/operators/equal' require 'saringan/operators/greater' require 'saringan/operators/greater_equal' module Saringan class Operator OPERATORS = [ Saringan::Operators::Equal, Saringan::Operators::GreaterEqual ] class << s...
true
42fd0ec07a6df72d551a141ebcc512fb5a36ed4b
Ruby
shioimm/til
/practices/exercism/ruby/2020/matrix.rb
UTF-8
256
3.6875
4
[]
no_license
# Matrix from https://exercism.io class Matrix def initialize(numbers) @numbers = numbers end def rows numbers.each_line.map { |n| n.split.map(&:to_i) } end def columns rows.transpose end private attr_reader :numbers end
true
7f78b3fd28599d966371dbf8f6e4865ff1f4522f
Ruby
bradenstaudacher/robot_test
/lib/weapon.rb
UTF-8
225
3.140625
3
[]
no_license
require_relative "robot" class Weapon < Item attr_accessor :damage def initialize(name, weight, damage) @name = name @weight = weight @damage = damage end def hit(robot) robot.wound(@damage) end end
true
afb7dd6385cd6ada29f74e3d3d7be1db424d6366
Ruby
agileanimal/core-data-parser
/lib/core-data-parser/data_model/entity.rb
UTF-8
671
2.6875
3
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
class CoreDataParser::DataModel class Entity attr_reader :name, :attributes, :relationships def initialize(entity) raise ArgumentError unless ::Nokogiri::XML::Element === entity @name = entity['name'] @attributes = entity.xpath('attribute').collect{|element| Attribute.new(element)} @...
true
352e9feb98688dbb787dc21b7d826b4241219c4a
Ruby
mohammadaliawan/ls-prep
/ruby_basics_3rd/user_input/ls_printer_1.rb
UTF-8
397
3.890625
4
[]
no_license
# print "Launch School is the best!" a certain number of times # Obtain the number of times from the user (atleast 3) number_of_lines = nil loop do puts ">> How many output lines do you want? Enter a number >= 3" number_of_lines = gets.chomp.to_i break if number_of_lines >= 3 puts ">> Thats not enough lines."...
true
549d44c5091ab69b551271a9d208490343e78fea
Ruby
eynaKane/HackerRankExercises
/counting_valleys.rb
UTF-8
493
3.8125
4
[]
no_license
# https://www.hackerrank.com/challenges/counting-valleys/problem require 'json' require 'stringio' require 'pry' def counting_valleys(n, s) ctr = 0 place = 0 traverse = 0 while ctr < n if s[ctr] == 'U' place += 1 traverse += 1 if place.zero? elsif s[ctr] == 'D' place -= 1 end ...
true
77c93442fe0f21371615308cff0a8d4efa4aa9f3
Ruby
RCarteri/mark7-qaninja
/automacao_do_zero/mark7/features/support/lib/dao.rb
UTF-8
992
2.953125
3
[]
no_license
require 'mongo' class DAO attr_accessor :client Mongo::Logger.logger = Logger.new('log/mongo.log') def initialize # mongodb://usuario:senha@servidor:porta/banco_de_dados str_con = 'mongodb://127.0.0.1:27017/markdb' # str_con = 'mongodb://aluno:qaninja@ds225078.mlab.com:27017/mongo...
true
0712d9bc65733c418dde812439633d0afdffc6c0
Ruby
thoom/restup
/lib/rest_up.rb
UTF-8
3,489
2.84375
3
[ "MIT" ]
permissive
require 'yaml' require 'logger' require 'net/http' require 'openssl' require 'uri' require 'config' require 'constants' module Thoom # General Error message returned by the class class RestUpError < RuntimeError attr_reader :message def initialize(message) @message = message end end # Makes...
true
4003f8ae8fc7395c83eb548c7fb17af8b676c1b2
Ruby
edwardpark/landlord-2
/db/seeds.rb
UTF-8
946
3.0625
3
[]
no_license
# don't forget to load dependencies! require "pg" require "active_record" require "pry" require_relative "../models/tenant.rb" require_relative "../models/apartment.rb" require_relative "../db/config.rb" # create at least 3 objects of the apartment class Apartment.create( {address:"234 Doom Street",monthly_rent: 2324,...
true
7b241b9cee50d9416cf4f82bcf8d1489ae0f4970
Ruby
rebekah/ruby_algorithms
/sort_helper.rb
UTF-8
246
2.78125
3
[]
no_license
module SortHelper def swap(array,item_1_index,item_2_index) swap_item_1 = array[item_1_index] swap_item_2 = array[item_2_index] array[item_1_index] = swap_item_2 array[item_2_index] = swap_item_1 array end end
true
45b323f2ff9eb8e85191ec86c4e481e5edab2788
Ruby
notmarkmiranda/nfl_suicide_league
/app/services/weekly_schedule_service.rb
UTF-8
509
2.8125
3
[]
no_license
require 'net/http' require 'uri' class WeeklyScheduleService attr_reader :xml def initialize(season:, type:, week:) uri = URI.parse("http://www.nfl.com/ajax/scorestrip?season=#{season}&seasonType=#{type}&week=#{week}") @xml = Net::HTTP.get(uri) end def parsed_xml base_hash = Hash.from_xml(xml)["s...
true
1e7c307e08f5c9652187f4ec153f21e95852e93b
Ruby
lisajo/object_oriented_blackjack
/oop.rb
UTF-8
5,703
4.0625
4
[]
no_license
class Card attr_accessor :value, :suit def initialize(v, s) @value = v @suit = s end def pretty_output "#{value} of #{suit}" end def to_s pretty_output end end class Deck attr_accessor :cards def initialize @cards = [] @values = %w[Ace 2 3 4 5 6 7 8 9 10 Jack Queen King] ...
true