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
23b7f19ade11f7b58f58b6fec4ecd143d1512244
Ruby
nitsujri/confucius-say
/lib/one_offs/process_scrape.rb
UTF-8
2,888
2.8125
3
[]
no_license
class OneOffs class ProcessScrape START_LINE = 0 def process data = gather_data data.drop(START_LINE).each_with_index do |d, i| scrape_data = d.data[:canto_dict] extract_char_data(d) # extract_compounds(scrape_data) break end # process_examp...
true
75f5969e908f6021141f6cd07daa8cee9148ae0e
Ruby
UbuntuEvangelist/therubyracer
/vendor/cache/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/remove_prefix_spec.rb
UTF-8
629
2.78125
3
[ "MIT" ]
permissive
require 'spec_helper' describe 'String#remove_prefix' do it 'removes a prefix in a string' do expect('Ladies Night'.remove_prefix('Ladies ')).to eq('Night') end it 'returns the original string if the parameter is not a prefix' do expect('Ladies Night'.remove_prefix('Night')).to eq('Ladies Night') end ...
true
fac5f7c600009e6a08fef8329cbe3a89a738a064
Ruby
AugustoPresto/LP-Store
/app/views/sessions_view.rb
UTF-8
359
2.921875
3
[]
no_license
require 'io/console' class SessionsView def ask_for_username puts "What's your username?" print "> " gets.chomp end def ask_for_password puts "What's the password?" print "> " STDIN.noecho(&:gets).chomp end def login_ok puts "Welcome!" end def wrong_credentials puts "Wr...
true
aae98d57ac1238a031a33a9d636573941c53cd73
Ruby
sayem/worldfactbook
/spec/worldfactbook/cli_spec.rb
UTF-8
2,081
2.6875
3
[ "MIT" ]
permissive
require File.dirname(__FILE__) + '/../spec_helper' require 'worldfactbook/cli' describe Worldfactbook::CLI, "execute" do describe "help" do before(:each) do @stdout_io = StringIO.new Worldfactbook::CLI.execute(@stdout_io, ['help']) @stdout_io.rewind @stdout = @stdout_io.read end ...
true
01f8cc659a53a2d9ee4734c39899891f3cf488ed
Ruby
zhouqinp/robot
/robot.rb
UTF-8
4,953
3.578125
4
[]
no_license
class Robot def initialize(name) @name = name @x = "NA" @y = "NA" @f = "NA" @ontable = false end # set some arrays for faces @@facelist = ["SOUTH", "NORTH", "EAST", "WEST"] @@facemove = [["SOUTH", 0, -1], ["NORTH", 0, 1], ["EAST", 1, 0], ["WEST", -1, 0]] @@turnlist = ["LEFT", "RIGHT"] ...
true
b801d83870852f11f18dc91a8e12cc0343da8d79
Ruby
antonylao/intro_to_ruby
/exercises/hash_creation_8.rb
UTF-8
103
3.046875
3
[]
no_license
h = {key: "value"} puts h h2 = {:key => "value!"} puts h2 h3 = Hash.new() h3[:key] = "value!!" puts h3
true
36d0b42c953eed9447a963673b193736a4f9f2f3
Ruby
linuxcat/dashBoard
/child_class.rb
UTF-8
394
2.546875
3
[]
no_license
require_relative './parent_class' class ChildClass < ParentClass element :title, "text_locator" element :login, "this is a login" class << self def title? title end end end child = ChildClass.new child.login ChildClass.title? array = "Done signing the test server. Moved it to test_servers...
true
9a659fa7999f667090211b922e23bf8cafa78582
Ruby
doahuang/aA-projects
/w2d2/board.rb
UTF-8
2,693
3.4375
3
[]
no_license
require_relative 'piece' class Board def initialize @grid = Array.new(8){ Array.new(8){ NullPiece.instance } } test_piece end def test_piece rook = [ [0,0], [0,7], [7,0], [7,7] ] rook.each do |pos| self[pos] = Rook.new(pos, self, :black) if pos.first == 0 self[pos] = Rook.new(pos, se...
true
3e9c124900db127b38ae8b9702cfdd020fe58524
Ruby
Alok255/hackerrank
/practice/algorithms/implementation/encryption/encryption.rb
UTF-8
240
3.125
3
[ "MIT" ]
permissive
input = gets.chomp width = Math.sqrt(input.length).floor height = Math.sqrt(input.length).ceil result = "" for i in 0...height do j = i while j < input.length result += input[j] j += height end result += " " end puts result
true
38fe620bb218abdef4c06e730841cb5c6030760c
Ruby
neonaddict/exception_hunter
/app/presenters/exception_hunter/error_group_presenter.rb
UTF-8
504
2.546875
3
[ "MIT" ]
permissive
module ExceptionHunter class ErrorGroupPresenter delegate_missing_to :error_group def initialize(error_group) @error_group = error_group end def self.wrap_collection(collection) collection.map { |error_group| new(error_group) } end def self.format_occurrence_day(day) day.t...
true
d044b211754a03b8278737c6ac2121fb968c7d3c
Ruby
kragen/shootout
/website/code/fibo-ruby.code
UTF-8
967
3.015625
3
[ "BSD-3-Clause" ]
permissive
<span class="slc">#!/usr/bin/ruby</span> <span class="slc"># -*- mode: ruby -*-</span> <span class="slc"># $Id: fibo-ruby.code,v 1.12 2006-09-20 05:51:23 bfulgham Exp $</span> <span class="slc"># http://www.bagley.org/~doug/shootout/</span> <span class="kwa">def</span> <span class="kwd">fib</span><span class="sym">(</...
true
beed30aa45c5823153770bfb42e9b9fd1a8ea0ab
Ruby
evanschrager/ember-presentation
/presentation.rb
UTF-8
3,497
2.734375
3
[]
no_license
require 'slide_hero' presentation 'EmberJS-and-Rails-2.0' do slide "EmberJS" do point "A Framework for Creating Ambitious Web Applications" image "fire.gif" note " the web derives its power from the ability to bookmark and share URLs. Ember marries the tools and concepts of native GUI frameworks with su...
true
c0696b6decddad45bc605a2375003b8066accdd2
Ruby
eychu/dotfiles
/roles/scripts/files/scripts/statparser.rb
UTF-8
1,185
2.875
3
[]
no_license
#!/usr/bin/env ruby # # Filter to convert my text status reports to wikitext. skip = false STDIN.read.strip.split("\n").each do |line| if skip skip = false next end case line # Lines to just drop when /^Status Report \d{2}-\d{2}-\d{4}/ skip = true when /^\s+Line items with quick description...
true
3c2692063775f9c1da3f4b807efc4457013e3dff
Ruby
JonHalloran/aA-homeworks
/W2D4/Octopus.rb
UTF-8
1,369
3.890625
4
[]
no_license
fish_arr = ['fish', 'fiiish', 'fiiiiish', 'fiiiish', 'fffish', 'ffiiiiisshh', 'fsh', 'fiiiissshhhhhh'] def slug_oct(fish_arr) current_fish = "" found_better = true while found_better found_better = false fish_arr.length.times do |ind| if fish_arr[ind].length > current_fish.length ...
true
75920d3349e52da322f0cf9f7234ca8293a4ab36
Ruby
PopularDemand/connect-four
/lib/game.rb
UTF-8
1,069
3.734375
4
[]
no_license
# Game # - match draw (when board full) # - win condition # - player turn logic =begin public interface #new - takes attrs{ player_red, player_blue, board } #play - HP - prints welcome - send message game loop private interface #game_loop - =end class Game def initialize(player_x:...
true
b4390380c031e5df4b7f6719455ef5f73cebf988
Ruby
nidialal/nid-mid
/hw1/part1.rb
UTF-8
694
3.453125
3
[]
no_license
#For those just starting out, one suggested way to work on your code is to have a command window open and a text editor with this #file loaded. Make changes to this file and then run 'ruby part1.rb' at the command line, this will run your program. Once you're #satisfied with your work, save your file and upload it to...
true
3bdc6f0568b5cdad21d98f21f35de24981f8f95f
Ruby
mollyseith/my-collect-dc-web-071618
/lib/my_collect.rb
UTF-8
118
3.15625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def my_collect(array) ret = [] i=0 while i<array.length ret.push yield(array[i]) i += 1 end ret end
true
ee3a8bd67d56d8c4cbc8b3f2122e7bbfac2920f6
Ruby
rhiannoncs/most-anticipated-books-cli-gem
/lib/most_anticipated_books/genre.rb
UTF-8
457
3.234375
3
[ "MIT" ]
permissive
class MostAnticipatedBooks::Genre attr_accessor :name @@all = [] def initialize(name) @name = name @@all << self @books = [] end def self.all @@all end def add_book(book) @books << book end def books @books end def book_count @books.size end def se...
true
cbd3b9f56f3d3a2634014bdc62982373854914d7
Ruby
bneuman-dev/battleship
/double/volley_results.rb
UTF-8
414
2.859375
3
[]
no_license
require_relative 'coord_translator' module VolleyResultsViewer include CoordTranslator def view_volley_results(results, player) hit_miss = {"H" => "hit", "m" => "miss"} puts "Shots by #{player.name}: " results.each do |result| puts from_coord(result[:coord]) + ": " + hit_miss[result[:result]] puts "Sun...
true
ec70c0e3e17266e5db6f98155ac200c271e48f42
Ruby
apalski/prime-ruby-v-000
/prime.rb
UTF-8
392
3.109375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Add code here! def prime?(number) number_array = (1..100).to_a result = 0 result_array = [] if number > 1 number_array.each do |x| result = number % x if result == 0 result_array << result end end if number > 100 result_array << 0 end if result_array.length...
true
ea6d5a26cc0634eb0a1a2b1825b4038878589794
Ruby
hdamico/school
/app/models/users/student.rb
UTF-8
658
2.65625
3
[]
no_license
module Users class Student < User has_many :course_students has_many :courses, through: :course_students has_one :challenge def enroll_course(course_id) raise ArgumentError unless courses << Course.find(course_id) end def start_course(course_id) raise ArgumentError unless load_co...
true
c27f560b2987d6be03b220a0adc008f1cfcfb444
Ruby
pharlanne/monday22
/specs/river_spec.rb
UTF-8
346
2.59375
3
[]
no_license
require ("minitest/autorun") require ("minitest/rg") #for green/red test require_relative("../river") require_relative("../fish") class TestRiver < MiniTest::Test def setup fish1=Fish.new("nemo") fish2=Fish.new("moby") fish3=Fish.new("goldie") @fish_group = [fish1, fish2,fish3] @river=River....
true
0ed5990e9caadbcaf8527d179a2bde4fe1695036
Ruby
marclevetin/codewars
/7kyu/money-money-money.rb
UTF-8
1,444
4.0625
4
[]
no_license
# https://www.codewars.com/kata/563f037412e5ada593000114 # Mr. Scrooge has a sum of money 'P' that wants to invest, and he wants to know # how many years 'Y' this sum has to be kept in the bank in order for this sum # of money to amount to 'D'. # # The sum is kept for 'Y' years in the bank where interest 'I' is paid y...
true
a587d9b4f66b4a99e24954b505a88d1bff6ae227
Ruby
J-Marriott/codewars
/6kyu/linux_history_4_final.rb
UTF-8
1,329
3.359375
3
[]
no_license
=begin In this kata you should complete a function that take in an string that correspond to s, and an history with the following format: and that should return the most recent command line that start with s, for example with s="more" and the above history it should return more me. If user ask for a s without any know...
true
9530228a7614e6c4ead291a4d9d360d881ba2bf9
Ruby
gfabro/ics-bootcamp17
/ch07/deafGrandmaExtended.rb
UTF-8
550
4.21875
4
[]
no_license
#HOW TO PROGRAM WITHOUT break : next puts 'Tell grandma something. You can only end the conversation once you shout "BYE" ' message = '' bye = 0 while bye < 3 message = gets.chomp if message == 'BYE'.chomp bye += 1 #Learned this from another program (Java NetBeans) bye == 3 elsif(messa...
true
c497e792f2d4a4b393b05d245664d50d72f1e007
Ruby
seanbehan/sinatra-frank
/lib/sinatra/flash_message.rb
UTF-8
491
2.828125
3
[ "MIT" ]
permissive
# Simple flash messaging in Sinatra # # require 'sinatra/flash_message' # # configure { enable :sessions } # helpers { def flash; @flash ||= FlashMessage.new(session); end } # # get '/' do # flash.message = 'hello world' # end # # <%= flash.message %> # class FlashMessage def initialize(session) @session ||= ...
true
b51853375211aea2ab9d7f7daf8d4524f554c936
Ruby
nicole7/rails_flashcards
/app/models/guess.rb
UTF-8
442
2.703125
3
[]
no_license
class Guess < ApplicationRecord belongs_to :round belongs_to :card has_one :user, through: :round def self.create_and_check_guess(card, answer, round) Guess.create(correct?: (answer.downcase.chomp == card.answer.downcase), round_id: round.id, card_id: card.id) end def self.get_correct_cards(guesses) ...
true
7af3211f0c2bdb09a7977cd5eb6d00c80e0efebb
Ruby
mmatney22/best_psych_books
/lib/psych_books/cli.rb
UTF-8
1,802
3.6875
4
[ "MIT" ]
permissive
class PsychBooks::CLI def call puts "\nWelcome to Goodreads Best Psychology Books!\n".green get_books list_books get_user_book end def get_books @books = PsychBooks::Book.all end def list_books puts "------------------------" puts " Greatest Psych Books " ...
true
929a8c82ffed918d47151d7f3b88f2456f4c39e5
Ruby
saipat/AA-Daily
/W1D2/memory_game/board.rb
UTF-8
927
3.6875
4
[]
no_license
require_relative 'card' class Board attr_accessor :grid GRIDSIZE = 6 def initialize @grid = Array.new(GRIDSIZE) { Array.new(GRIDSIZE) } @values = ((1..GRIDSIZE*GRIDSIZE/2).to_a * 2).shuffle populate end def reveal(guess_pos) self[guess_pos].reveal self[guess_pos].value end def won? ...
true
7ee90291700b934e43b00641091f6fe6a82bbad6
Ruby
jztimm/programming-univbasics-4-simple-looping-lab-nyc01-seng-ft-071320
/lib/simple_loops.rb
UTF-8
608
4.1875
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# Write your methods here # ex_arr = ["this", "is", "for", "a", "method"] def loop_message_five_times(message) counter = 0 while counter < 5 do puts message counter += 1 end end def loop_message_n_times(message, n) count = 0 while count < n do puts message count += 1 end end def output...
true
e81956980c759fae006eccbcdbe8d7c0299283f1
Ruby
matiasanaya/toy-robot-simulator
/test/test_pose.rb
UTF-8
3,981
2.890625
3
[ "Unlicense" ]
permissive
require_relative '../lib/toy_robot/pose' require_relative 'test_pose_interface' require_relative 'test_reporter_interface' require 'minitest/autorun' module ToyRobot class PoseTest < MiniTest::Unit::TestCase include PoseInterfaceTest include ReporterInterfaceTest def setup @x, @y = 0, 1 @or...
true
bbece08b8fbacb719198a6231d0539acd676a006
Ruby
haydenlangelier/phase-0-tracks
/databases/fitness_tracker.rb
UTF-8
3,371
3.859375
4
[]
no_license
# This is my fitness tracker # It will be used for tracking, storing, editing, adding new data on how far you have ran, and how many #calories on each run etc..... #here i require the two gems needed require 'sqlite3' require 'faker' #creating a new fresh datbase db = SQLite3::Database.new("running.d...
true
3b2c7fb796b65043ad58150394b1894c5690035b
Ruby
kdiogenes/iron_cache_ruby
/lib/iron_cache/caches.rb
UTF-8
2,742
2.703125
3
[]
no_license
require 'cgi' module IronCache class Caches attr_accessor :client def initialize(client) @client = client end def path(options={}) path = "projects/#{@client.project_id}/caches" if options[:name] path << "/#{CGI::escape(options[:name]).gsub('+', '%20')}" end ...
true
2f36720935d53a280acb4a102d968071ee1d466e
Ruby
samanthagottlieb/makersbnb
/lib/home.rb
UTF-8
1,037
3.140625
3
[]
no_license
class Home attr_reader :id, :user_id, :name, :description, :price def initialize(id:, user_id:, name:, price:, description: 'Another lovely house') @id = id @user_id = user_id @name = name @description = description @price = price end def self.create(name:, description:, price:, username: ...
true
e1fdb096bee9054d3eca64e9427ec98bad874684
Ruby
akhilsingla97/Dispatchr
/dispatchr-ruby/app/models/store.rb
UTF-8
692
3.265625
3
[]
no_license
require 'haversine.rb' class Store < ApplicationRecord has_many :items, through: :item_stores belongs_to :address validates :address_id, presence: true validates :name, presence: true def self.find_nearest_store(lat, long) store_id = -1 distance = 150 #150 meters within a store Store.all.each do ...
true
188dc5ea82117dbde679b82019ad628ecbd0e4f2
Ruby
frodrigueza/kanbantt2
/app/helpers/tasks_helper.rb
UTF-8
2,285
2.6875
3
[]
no_license
module TasksHelper def real_image(real) if real < 8 '0.png' elsif real < 20 'r1.png' elsif real < 33 'r2.png' elsif real < 46 'r3.png' elsif real < 58 'r4.png' elsif real < 71 'r5.png' elsif real < 83 'r6.png' elsif real < 96 'r7.png' ...
true
a5f10cc8e066d222970e6108b23e2a8c3efeaba4
Ruby
almihoil/TECH.C
/submit/Sairi7/1011wc.rb
UTF-8
293
3.125
3
[]
no_license
def wc(file) lines = 0 words = 0 chars = 0 file = File.open(file, "r") while line = file.gets lines += 1 chars += line.length wordArray = line.split(/\s+/).reject{|w| w.empty?} words += wordArray.length end put "lines=#{lines} words=#{words} chars=#{chars}" end wc(ARVG[0])
true
8c095f2e9dd316c10fa37661153e760bd51f1da1
Ruby
gdpelican/rainbow_bandit
/lib/rainbow_scraper.rb
UTF-8
2,182
2.5625
3
[]
no_license
require 'open-uri' require 'nokogiri' require './models/color' require './models/url' require 'byebug' require 'screencap' class RainbowScraper def execute exit 0 if Url.find_by(url: random_url) return unless random_url_body puts "Found #{random_url_stylesheet_colors} at #{random_url}" random_url_s...
true
6767d45779c89d31481398177d55085152ad5291
Ruby
SpringMT/study
/ruby/ruby_doujou/variable2.rb
UTF-8
194
3.015625
3
[]
no_license
class Foo def foofoo @a= 1 end def a @a end def b @b end end class Baa < Foo def baa_a @a end end obj = Foo.new obj.foofoo p obj.a p Foo.new.b p Baa.new.baa_a
true
17b5a5843529f3ae55b80e436edf07d3cf5a9906
Ruby
pelf/advent-of-code-2019
/day12/day12_part2.rb
UTF-8
2,098
3.09375
3
[]
no_license
class Body attr_reader :pos, :vel def initialize(x, y, z) @pos = [x, y, z] @vel = [0, 0, 0] end def energy pot * kin end def to_s # "#{pos}#{vel}" "#{pos[0]}" end private def pot pos[0].abs + pos[1].abs + pos[2].abs end def kin vel[0].abs + vel[1].abs + vel[2].abs...
true
47340ff5e572f37cab70bf958fe1e5012a97626e
Ruby
edb-c/ruby-object-attributes-lab-v-000
/lib/person.rb
UTF-8
451
3.4375
3
[]
no_license
class Person #name reads the name of the person from an instance variable @name def name @name end #name=writes the name of the person to an instance variable @name def name=(new_name) @name = new_name end #job reads the job of the person from an instance variable @job def job ...
true
50df9ad3c92784eaa00910b14578e099c380531d
Ruby
alanthewelsh/cc-week2-day3-snakeandladders
/specs/die_spec.rb
UTF-8
433
2.859375
3
[]
no_license
require('minitest/autorun') require_relative('../board.rb') require_relative('../player.rb') require_relative('../die.rb') class TestDie < Minitest::Test def test_die_can_produce_number new_dice = Die.new() new_dice_number = new_dice.roll assert_includes((1..6), new_dice_number) end # def test_die_...
true
0d6c606c38d3091f1e6d5eb69ba74743b2d8de45
Ruby
dallinder/small_problems_ls
/easy_7/5.rb
UTF-8
270
3.65625
4
[]
no_license
def staggered_case(string) chars = string.chars chars.each_with_index do |c, i| if i.even? c.upcase! else c.downcase! end end chars.join('') end puts staggered_case('I Love Launch School!') puts staggered_case('ignore 77 the 444 numbers')
true
0389fe815e887e1922910758d4ed2ddc55f17c3d
Ruby
snrk-m/ruby
/ruby/lesson2.rb
UTF-8
72
2.6875
3
[]
no_license
puts "私の名前は村田です。"+"年齢は"+24.to_s+"歳です。"
true
b56910992ad865e7646864abf1b20005774d443e
Ruby
y-amadatsu/himeshima-mamoru
/app/models/reservation.rb
UTF-8
575
2.53125
3
[]
no_license
# frozen_string_literal: true require 'csv' class Reservation < ApplicationRecord belongs_to :user, class_name: 'User', foreign_key: :imported_user_id, optional: true, inverse_of: :reservation def age (Time.zone.today.strftime('%Y%m%d').to_i - birthday_on.strftime('%Y%m%d').to_i) / 10_000 end # TODO: 編集...
true
a9fca059c7d58e20e474f8ae8f6ec467aef20c96
Ruby
DawidGaleziewski/LocalUdemyRuby
/29_equality_with_strings.rb
UTF-8
189
2.890625
3
[]
no_license
a = "Hello" b = "hello" c = "Hello" p a != "zebra" p a == "lion" p a == b p a == c p a != b puts p "Apple" < "Banana" p "hello" < "help" puts p "A" < "a" p true == true p true == false
true
9bad02c9cecb01671c97686031d44b9ce9a559e4
Ruby
IsmaelSANE/learn-to-program
/table-of-contents-revisited.rb
UTF-8
586
3.09375
3
[]
no_license
line_width = 40 contents = ["Table of Contents", "Chapter 1:", "Getting Started", "page 1", "Chapter 2:", "Numbers", "page 9", "Chapter 3:", "Letters", "page 13"] puts '' puts(contents[0].rjust( line_width)) puts '' puts '' puts(contents[1].ljust(line_width/3) + contents[2].ljust(line_width) + ...
true
be68d9d332c3f54310fadff56b93762d66dfb8a6
Ruby
StuartHadfield/robbi-bot
/bot.rb
UTF-8
4,756
2.953125
3
[ "MIT" ]
permissive
require 'sinatra/base' require 'slack-ruby-client' require 'httparty' # This class contains all of the webserver logic for processing incoming requests from Slack. class API < Sinatra::Base # This is the endpoint Slack will post Event data to. post '/events' do # Extract the Event payload from the request and ...
true
d0b61b66892d3fa875a9c9be7b4aff2209115cf5
Ruby
lp/cordovan
/lib/cordovan_helpers.rb
UTF-8
1,113
2.90625
3
[ "MIT" ]
permissive
# Author:: lp (mailto:lp@spiralix.org) # Copyright:: 2009 Louis-Philippe Perron - Released under the terms of the MIT license # # :title:Cordovan class Cordovan private def fit_in_grid(style) style[:v_span] = @v_grid if style[:v_span].nil? style[:h_span] = @h_grid if style[:h_span].nil? style[:v_pos] = 1 if s...
true
67950cde6791f9aa31731f600bf9daa7c58ab13b
Ruby
JamesJinPark/mcit-waiver
/app/controllers/courses_controller.rb
UTF-8
3,564
2.640625
3
[]
no_license
# == Schema Information # # Table name: courses # # id :integer not null, primary key # name :string(255) # created_at :datetime not null # updated_at :datetime not null # user_id :integer # email_opt_in :boolean # class CoursesController < ApplicationControlle...
true
605b9d71d498b0ac8ba52d0fcf25408587bf28ce
Ruby
MarilenaRoque/CodeChallenges
/full_merge_sort.rb
UTF-8
1,358
3.53125
4
[]
no_license
def merge_sort(array1, array2) idx_1 = 0 idx_2 = 0 sorted_array = [] n = array1.length + array2.length n.times do |count| if array2[idx_2].nil? sorted_array << array1[idx_1] idx_1 +=1 elsif (array1[idx_1].nil? && array2[idx_2]) sorted_array << array2[idx_2] ...
true
6a055dba8596a4f0aab3066ad9f1bbe56591afa1
Ruby
spike886/10pines
/lib/strategy.rb
UTF-8
462
2.8125
3
[]
no_license
class Strategy attr_accessor :system def execute shares shares_to_sell=shares.select do |share| share.purchased && filter_shares_to_sell(share) end shares_to_buy=shares.select do |share| filter_shares_to_buy(share) end shares_to_buy.sort! do |first_share, second_share...
true
025a5679fbdb027164ec703e989d6337a1d25bf8
Ruby
itggot-william-bruun/standard-biblioteket
/lib/average.rb
UTF-8
406
4.28125
4
[]
no_license
# Public: Takes an array and returns a average # # sum - The sum of the array. # i - Iteration agent and number of integers in the array. # avg - The average of the array. # # Examples # # average([1,2,3,4]) # # = > 2,5 # # Returns the average. def average(arr) sum = 0 i = 0 while i < arr.length ...
true
d7215a5dc594212f89c9a2467fd2fffadb9b4cf0
Ruby
simon74/ruby-atm-microcourse
/step1_begin.rb
UTF-8
779
4.375
4
[]
no_license
# Imagine an ATM with ONLY $5 notes. The function accepts a single parameter - amount. # Return false if the amount cannot be given in $5 notes (eg. 23 or 36). # Otherwise, return an array of notes - eg. withdraw(15) would return [5, 5, 5] # TIPS: # Modulus operator (%) gives the remainder. So, 5 % 2 = 1 (five divided ...
true
b8d7a9ed23ad643df4d6f01600415695fbb5fdad
Ruby
alexdean/eight_corner
/lib/eight_corner/quadrant.rb
UTF-8
579
3.171875
3
[ "MIT" ]
permissive
module EightCorner # a Bounds has 4 quadrants. # TODO: singleton instance for each quadrant? # would allow each to return their own angle_range_for. module Quadrant UPPER_LEFT = 0 UPPER_RIGHT = 1 LOWER_RIGHT = 2 LOWER_LEFT = 3 def self.angle_range_for(quad) # the valid range of ang...
true
6032b43bf38ba16669bf324788e29aeb3094f435
Ruby
StephanYu/rock_paper_scissors_gem
/spec/entities/game_spec.rb
UTF-8
1,057
2.890625
3
[ "MIT" ]
permissive
require_relative '../spec_helper.rb' describe RockPapeScis::Game do describe "#play" do it "returns the player's name who chose ROCKS > SCISSORS" do result = RockPapeScis::Game.play(player1 = {name: "John", move: "rock"}, player2 = {name: "Stephan", move: "scissors"}) expect(result).to eq "John" ...
true
353cc1889776437dcc998ebb8b794be83b5471dd
Ruby
jimmyz/familysearch-api-examples
/ruby/01_read_person_simple.rb
UTF-8
819
2.671875
3
[]
no_license
require 'faraday' require 'json' require 'pp' # For sake of demonstration, we will acquire an access token from # https://sandbox.familysearch.org/platform/ access_token = File.read 'access_token.txt' client = Faraday.new () do |faraday| faraday.response :logger faraday.headers['Accept'] = 'application/x-fs-v1+js...
true
d089362f7dd8da2c646fdc4fde77caf6667244fa
Ruby
virtusize/build_script
/Buildfile
UTF-8
2,725
2.578125
3
[]
no_license
define HELP_MESSAGE Usage: make [COMMAND] Commands: build Build a Docker image. tag Tag the created image in local repository. push Push the Docker image to Docker Hub, will not push develop or feature-* tags. force-push Push the Docker image to Docker Hub. help Display this help...
true
23e28210d4c3d21e0b75575b0e2cdef5c71d0d9b
Ruby
MisterMur/collections_practice_vol_2-nyc-web-career-010719
/collections_practice.rb
UTF-8
809
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# your code goes here def begins_with_r(tools) tools.each do |i| if i.start_with?('r')==false return false end end true end def contain_a(array) array.select do |i| i.include?('a') end end def first_wa(array) array.each do |i| if i.is_a?(String) && i.start_with?('wa') re...
true
85fd285fcbced1fd42419831e67787cd3561ed36
Ruby
pygospa/researchr
/vendor/gems/unicode_utils-1.0.0/lib/unicode_utils/each_word.rb
UTF-8
3,106
3.015625
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
# -*- encoding: utf-8 -*- require "unicode_utils/read_cdata" module UnicodeUtils # Maps codepoints to integer codes. For the integer code to property # mapping, see #compile_word_break_property in data/compile.rb. WORD_BREAK_MAP = Impl.read_hexdigit_map("word_break_property") # :nodoc: # Split +str+ alo...
true
4d297a9b130662253496386804c717cb1957f480
Ruby
JunaidQ/deadlink
/lib/tasks/manual_broken_llink.rake
UTF-8
640
2.546875
3
[]
no_license
namespace :pick do desc "Pick manual broken link" task :manual_link => :environment do if Rails.env == 'production' root = 'production_url' else root = 'http://localhost:3000' end puts "Enter specific link with compny address ====> /some-link: " u = STDIN.gets.chomp url = root.c...
true
96e1ced59f8709a6040c0f0fe62c127985ee33f5
Ruby
isakib/prickle
/lib/prickle/capybara/xpath.rb
UTF-8
668
2.578125
3
[]
no_license
require_relative 'xpath/expression' module Prickle module Capybara module XPath def self.for_element_with type, identifier XPath::Element.new(type,identifier).to_s end private class Element def initialize type, identifier @type = type @identifier = i...
true
52bb4913e6579310d59a1465c7b73e3d3e0d703b
Ruby
MrSnickers/FIS
/activities/playlister/playlister_partA/lib/genre_class.rb
UTF-8
319
3.265625
3
[]
no_license
### GENRE CLASS class Genre attr_accessor :name @@genre_array = [] def initialize @@genre_array << self end def self.reset_genres @@genre_array = [] end def songs @songs ||= [] end def artists songs.collect{|song| song.artist}.uniq end def self.all @@genre_array end end
true
bd61352a1f3cb64aecf7df81d20c9150eb46c164
Ruby
joshsarna/interview_cake
/reverse_words.rb
UTF-8
184
3.953125
4
[]
no_license
# Write a method reverse_words!() that takes a message as a string and reverses the order of the words in place. def reverse_words!(message) message.split(" ").reverse.join(" ") end
true
cc46c564ad00ac17559ddc130f11531c06e30399
Ruby
radu-constantin/prep_work
/final_exercises/exercise16.rb
UTF-8
209
3.21875
3
[]
no_license
#delete all words that start with "s" a = ['white snow', 'winter wonderland', 'melting ice', 'slippery sidewalk', 'salted roads', 'white trees'] a.map! do |word| word.split(" ") end a.flatten puts a
true
c68e973313f004011fa10ff751f71786db18c69a
Ruby
bookmate/bm-cancellation
/lib/bm/cancellation.rb
UTF-8
1,489
2.578125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'bm/cancellation/version' require 'bm/cancellation/interface' require 'bm/cancellation/signal' require 'bm/cancellation/deadline' require 'bm/cancellation/either' module BM # Provides tools for cooperative cancellation and timeouts management. module Cancellation class <<...
true
2efb2e53a606487e0d8439bcf4b171d49ecf4834
Ruby
darkripper/Tumble.rb
/lib.rb
UTF-8
2,007
2.640625
3
[]
no_license
require 'rubygems' require 'ruby-multipart-post' require 'active_support' def rename_jpegs_to_jpgs files = Dir['*.jpeg'] files.each do |filename| filerenamed = filename.gsub('.jpeg', '') + '.jpg' File.rename(filename, filerenamed) end end def select_files_to_upload rename_jpegs_to_jpgs files = Dir['*.j...
true
f4907b0b2db440ddc4bb29d39aae147f6a615434
Ruby
relaton/iso-bib-item
/lib/iso_bib_item/iso_document_status.rb
UTF-8
1,742
2.734375
3
[ "MIT", "BSD-2-Clause" ]
permissive
# frozen_string_literal: true require 'iso_bib_item/document_status' require 'iso_bib_item/localized_string' module IsoBibItem # module IsoDocumentStageCodes # PREELIMINARY = '00' # PROPOSAL = '10' # PREPARATORY = '20' # COMMITTE = '30' # ENQUIRY = '40' # APPROVAL = '50' ...
true
e57caca5c01a2a74285021ef3acf792d6eef6c9b
Ruby
LifebookerInc/hash_dealer
/spec/lib/path_string_spec.rb
UTF-8
2,104
2.671875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe PathString do it "should match values with a ':' as wildcards" do PathString.new(":test").should == PathString.new("abcdefg") end it "should work on nested hashes and arrays" do PathString.as_sorted_json(:abc => [":1",":2",":3...
true
b1f100656d0b2efc4adf0755869d25541cc2aab5
Ruby
ezrashim/blackjack
/spec/blackjack_spec.rb
UTF-8
4,386
3.484375
3
[]
no_license
require_relative "../card" require_relative "../hand" require_relative "../deck" require_relative "../player" require_relative "../dealer" require_relative "../blackjack" RSpec.describe Card do let (:card) { Card.new('♦', 'A') } describe '.new' do it 'creates a card' do expect(card.cla...
true
b57de3dcdbeba81314dc4bc1fa1efbc5c99372a6
Ruby
Besermenji/Table-Reservation
/vendor/bundle/ruby/2.2.0/gems/authority-3.1.0/lib/authority/authorizer.rb
UTF-8
1,698
2.890625
3
[ "MIT" ]
permissive
module Authority class Authorizer # The base Authorizer class, from which all the authorizers in an app will # descend. Provides the authorizer with both class and instance methods # like `updatable_by?(user)`. # Exactly which methods get defined is determined from `config.abilities`; # the class ...
true
3d85a227199c20f1406b5cd27fecd9dd9b4e0c3a
Ruby
vanithajayasri/ruby_assignment2_question1
/app/controllers/concerns/foobar.rb
UTF-8
154
2.90625
3
[]
no_license
class Foobar # ENTER CODE FOR Q2 HERE def initialize(k) # instance method @k = k end def bar(y, arr={}) "#{y}#{@k}#{arr[:sat]}" end end
true
67b5f596342e17c6083c0c2797257fed878960ea
Ruby
bsboris/git_reporting
/lib/git_reporting/message_parser.rb
UTF-8
855
2.890625
3
[ "MIT" ]
permissive
require "chronic_duration" module GitReporting class MessageParser attr_reader :input, :regexp def self.parse(*args) new(*args).parse end def initialize(input) @input = input.to_s prefix = GitReporting.configuration.prefix @regexp = /\[\s*#{prefix && prefix + "\s*"}\s*(\d[^\...
true
733646f9a46518e86d3f65e46e6ae9c713072f82
Ruby
fakebenjay/parrot-ruby-web-0217
/parrot.rb
UTF-8
60
2.734375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def parrot(polly="Squawk!") puts polly return polly end
true
463cfeb8207249dfab337ea3411833c245d7ab99
Ruby
jo-hackson/phase-0-tracks
/ruby/hashes.rb
UTF-8
2,592
4.28125
4
[]
no_license
# first create a hash called "form" to store the information # it is unnecessary to create empty values because the keys will be added anyways form = {} # client name # prompt the user to input client name # capitalize to make sure that it is grammatically correct puts "What is the client's first name?" first_name = ...
true
fd18e6dfcf9adc55ad5a033907ec50f9697826e1
Ruby
blake97/phase-0-tracks
/ruby/A.rb
UTF-8
1,571
4.09375
4
[]
no_license
########### Business Methods ########### #reference vowels = "aeiou" consonants = "abcdefghijklmnopqrstuvwxyz".delete("#{vowels}") transformed_array =[] def name_processing (input_name) reverse_name = input_name.split(' ').reverse.join(' ') # <== reverse and break into characters. characters_array = reverse_nam...
true
bc9079dd3e842427a9bf736668b64314f5d6291c
Ruby
uranussg/aA_classwork
/W1D3/nauseating_numbers/phase_1.rb
UTF-8
1,867
3.6875
4
[]
no_license
def strange_sums(arr) count = 0 arr[0..-2].each_with_index do |el, idx| count +=1 if arr[idx + 1..-1].include?(-el) end count end # p strange_sums([2, -3, 3, 4, -2]) # 2 # p strange_sums([42, 3, -1, -42]) # 1 # p strange_sums([-5, 5]) # 1 # p strange_sums([19, 6, -3, -20...
true
6816d6dc74078d75571f4989885c18c5a6d146ac
Ruby
agorf/adventofcode
/2018/04/2.rb
UTF-8
802
2.828125
3
[]
no_license
#!/usr/bin/env ruby require 'time' entries = $stdin.readlines.map { |line| { when: Time.parse(line), id: line[/(?<=#)\d+/], action: line.split(' ').last(2).join(' ') } }.sort_by(&:first) prev_id = nil # Fill-in missing guard ids entries.each do |entry| if entry[:id].nil? entry[:id] = prev_id ...
true
ca71a61f3e5582460cde3d95e4cb3000b5e3a5bb
Ruby
mochacaremel/ttt-4-display-board-rb-v-000
/lib/display_board.rb
UTF-8
951
3.953125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def display_board(board) puts " #{board[0]} | #{board[1]} | #{board[2]} " puts "-----------" puts " #{board[3]} | #{board[4]} | #{board[5]} " puts "-----------" puts " #{board[6]} | #{board[7]} | #{board[8]} " end # def display_board # board = [" "," "," "," "," "," "," "," "," "] # (rows[0]).to...
true
3ac6eab86feec77e21764535700ca083459efd78
Ruby
marcos-x86/AT04_API_test
/MarcosLara/Session_02/Practice_04/customer_id.rb
UTF-8
702
4.125
4
[]
no_license
=begin Write 1 Method called customer_id This Methods - Should receive 2 arguments : name and customer_id - Using short-if expression evaluate the id value according : - Only if ID is greater than 100 print the message “Thanks to be our customer” otherwise only print “Thanks” - Change to uppercase the name Prin...
true
3590d5dbf40c54ec878e5683f7f1147cf43743c6
Ruby
gtormiston/ruby-kickstart
/session2/3-challenge/6_array.rb
UTF-8
1,024
4.53125
5
[ "MIT" ]
permissive
# Write a method named prime_chars? which takes array of strings # and returns true if the sum of the characters is prime. # # Remember that a number is prime if the only integers that can divide it with no remainder are 1 and itself. # # Examples of length three # prime_chars? ['abc'] # => true # prime_char...
true
729f9294e718fc56c03ab2ac08bf70217e27a2fd
Ruby
DanielHauge/LanguageProject
/Ruby/problem3.rb
UTF-8
420
3.421875
3
[ "MIT" ]
permissive
load 'problem.rb' require 'set' class Problem3 < Problem def initialize(list, exp) @list = list @exp = exp end def Calculate() counter = 0 s1 = Set[] for i in @list if i == counter+1 counter = counter + 1 while (s1.include?(counter+1)) counter = counter + 1 ...
true
c02fad637522d1d91b77f5f9617b1258530c0bf4
Ruby
pacojp/cwalert-disk2
/mrblib/cwalert-disk2.rb
UTF-8
2,541
2.5625
3
[]
no_license
class Checker attr_accessor :verbose, :hostname, :mount_points, :warning_hours, :room_id, :token, :users_to def initialize(config) self.verbose = config["verbose"] || false self.hostname = config["hostname"] || `hostname`.strip self.mount_points = config["mount_points"] self.warning_hours = con...
true
744f2bd58dc034339d072c3495f42bd35eceb9aa
Ruby
Gunn8604/ruby-music-library-cli-onl01-seng-pt-070620
/lib/genre.rb
UTF-8
545
2.78125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Genre extend Concerns::Findable attr_accessor :name, :songs @@all = [] def initialize(name) @name = name @songs = [] save #saving all instances of the genre created end def self.all @@all end def self.destroy_all @@all = [] end def save @@all << self end # def self.c...
true
ec6f4520ec1730b489ff211c5a93fb2329d41297
Ruby
kue-ipc/ikamail
/lib/japanese_wrap.rb
UTF-8
7,599
2.875
3
[ "MIT" ]
permissive
# 日本語におけるワードラップや禁則処理を行う # 参考文献 # * JIS X 4051 # * 日本語組版処理の要件 (日本語版) https://www.w3.org/TR/jlreq/ # ワードラップも行うが、JISであることを前提とし、厳密性にはかける。 # 割注始め括弧類や割注終わり括弧類は、それぞれの括弧類に含まれる。 # JIS X 4051 / 日本語組版処理の要件 との違い # * 濁音・半濁音を行頭禁止文字に含める。 # * 合字である「ㇷ゚ U+31F7 U+309A」を考慮しないが、実質行頭禁止になる。 require 'set' module JapaneseWrap module_functi...
true
495d65ab18f8a3c926f9290da71a9ee977410c09
Ruby
aQuaYi/computation
/small-step/while.rb
UTF-8
318
2.859375
3
[ "MIT" ]
permissive
# frozen_string_literal: true class While < Struct.new(:condition, :body) def to_s "while (#{condition}) { #{body} }" end def inspect "«#{self}»" end def reducible? true end def reduce(environment) [If.new(condition, Sequence.new(body, self), DoNothing.new), environment] end end
true
87d9b45e6776e196b05dce6127d17a3bcf5fe248
Ruby
andrewsunglaekim/wdi_dc5_instructors
/exercise_bank/rspec/simon_says/lib/simon_says.rb
UTF-8
478
3.953125
4
[]
no_license
class Simon def self.echo(word) word end def self.shout(str) str.upcase end def self.repeat(word, y=2) arr = [] y.times do arr << word end arr.join(' ') end def self.start_of_word(word, y) word[0..y-1] end def self.first_word(str) str.split.first end def self.titleize(str) ...
true
fdb189a2133df54d4c27756338b444137f367f70
Ruby
VimIcewind/Code
/ruby/weeks.rb
UTF-8
297
2.8125
3
[]
no_license
#!/usr/bin/ruby $LOAD_PATH << '.' require "support" class Decade include Week no_of_yrs = 10 def no_of_months puts Week::FIRST_DAY number = 10 * 12 puts number end end d1 = Decade.new puts Week::FIRST_DAY Week.weeks_in_month Week.weeks_in_year d1.no_of_months
true
ae5461bf261d55c79a97120a943b1c96231b7e6a
Ruby
Swati24/algorithms
/Old Dynamic Programming/Longest Palindromic Subsequence/prog.rb
UTF-8
740
3.234375
3
[]
no_license
class Prog attr_accessor :string def initialize(string) @string = string end def process matrix = Array.new(string.length){Array.new( string.length )} i = 0 while(i <= string.length) j = 0 while( j <= string.length - 1) if i + j < string.length if i == 0 ...
true
cc95d0b32b1154838f87845c56886ca72b794f10
Ruby
natgit8/ttt-10-current-player-v-000
/lib/current_player.rb
UTF-8
658
4.46875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def turn_count(board) #defining turn_count and giving it a argument of board turn_count = 0 #setting turn_count to 0 to begin our counter board.each do |turn| #going through each index of the array if turn == "X" || turn == "O" #setting our if statement to see if there is an X or O in an index turn_count ...
true
4d375cab14d1f80836cf9b1d21d3e946a3da3df8
Ruby
yuihyama/funcrock
/test/isodd_test.rb
UTF-8
557
2.828125
3
[ "MIT" ]
permissive
require 'minitest/autorun' require './lib/isodd' class IsOddTest < Minitest::Test def test_isodd assert_equal false, isodd(0) assert_equal true, isodd(1) assert_equal false, isodd(2) assert_equal true, isodd(-1) assert_equal false, isodd(-2) assert_raises(NoMethodError) { isodd(1.1) } a...
true
ec81137d340275558f79023367de3a5ae7a0375a
Ruby
karpet/elasticsearch-rails-ha-gem
/spec/temp_db_helper.rb
UTF-8
1,650
2.53125
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
require 'tempfile' # stub so we can setup schemas below class Article < ActiveRecord::Base end class TempDBHelper @@_db_file = nil def self.setup if @@_db_file refresh_db end setup_schemas seed_data end def self.quiet ENV['QUIET'] end def self.db_file @@_db_file ||= Tempfi...
true
ce62e03d2a7dd7538657f3d12c25bf62b8fb39dc
Ruby
amclain/duet-bootstrap
/bin/duet-bootstrap
UTF-8
6,061
2.59375
3
[ "Apache-2.0" ]
permissive
#! /usr/bin/env ruby # Duet Bootstrap # v1.1.2 # # Website: https://sourceforge.net/projects/duet-bootstrap # # # -- THIS IS A THIRD-PARTY TOOL AND IS NOT AFFILIATED WITH -- # -- THE AMX ORGANIZATION -- # # # This script was designed to run on Ruby v2.0.0-p0 # http://www.r...
true
fa342da899e2bedb57a891a63f33bc3a5f9e7017
Ruby
AGL745/Launch_School
/Drills/July/vowels_delete.rb
UTF-8
230
3.5
4
[]
no_license
VOWELS = %w(a e i o u).freeze def vowel_remover(words) words.map do |word| chars = word.split('') VOWELS.each { |vowel| chars.delete(vowel) } chars.join('') end end p vowel_remover(%w(green yellow black orange))
true
c2dc4b10c76bd5fc07796870b34b31232475dbd7
Ruby
hermesalexis/ruby
/exception.rb
UTF-8
400
3.859375
4
[]
no_license
class Person attr_reader :name def initialize(name) self.name = name end # nuestro propio método de escritura para name def name=(name) raise ArgumentError, "El nombre no puede ser vacío" if name.nil? @name = name end end p = Person.new("Juan") p.name = "Pedro" # no lanza excep...
true
14565c6a1b7493d2f6c8dd4853526976c47cdcbe
Ruby
oreeve/korning
/import.rb
UTF-8
3,633
2.78125
3
[]
no_license
# Use this file to import the sales information into the # the database. require "pg" require 'csv' require 'pry' system 'psql korning < schema.sql' def db_connection begin connection = PG.connect(dbname: "korning") yield(connection) ensure connection.close end end @sales = [] @frequency = [] @emp...
true
1586649a300024c738b1479af3f972a544156eac
Ruby
MBAPPOU/Projet-Ruby-YvanMBAPPOU
/http.rb
UTF-8
1,625
3.125
3
[]
no_license
module HTTP require 'socket' class Request attr_reader :socket ,:request , :headers, :body def initialize (socket) @socket = socket @headers = Hash.new if socket read end end # lit le socket et retourne la requete et les headers def read # request parsing @request = @socket.gets # On lit sur le...
true
8b7e991076da68113617880ebb0f4ee704f2c52e
Ruby
rn0rno/kyopro
/aoj/ruby/01_ALDS/ALDS1_1_C.rb
UTF-8
290
3.640625
4
[]
no_license
#!/usr/bin/env ruby def prime?(x) return true if x == 2 return false if x < 2 || (x % 2).zero? i = 3 while i <= Math.sqrt(x) return false if (x % i).zero? i += 2 end true end n = gets.chomp.to_i cnt = 0 n.times do cnt += 1 if prime?(gets.chomp.to_i) end puts cnt
true
9fd81e554602ebe347d20efab372ceb31231a1b2
Ruby
djpate/email_parser
/lib/email_parser/parsers/email_parser.rb
UTF-8
521
2.921875
3
[]
no_license
module EmailParser module Parsers class EmailParser attr_reader :email_string def initialize email_string @email_string = email_string scanner.scan_until( empty_line_matcher ) end def header @header ||= scanner.pre_match end def body @body ||=...
true
bd8f04e9e8d8e7cdc2a8ecf963000904473ef054
Ruby
rgilbert82/Data-Structures
/stack_test.rb
UTF-8
1,160
2.90625
3
[]
no_license
require 'minitest/autorun' require 'minitest/reporters' Minitest::Reporters.use! require_relative 'stack' class StackStructureTest < Minitest::Test def setup @stack = StackStructure.new end def test_initialize assert_equal @stack.data, [] end def test_push @stack.push('hello') assert_equal...
true