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
f06c715b745de95ca1a883d97199deefeb2a2e1c
Ruby
eljetico/datawrangler
/test/data_wrangler/formatter_test.rb
UTF-8
1,974
2.71875
3
[]
no_license
# frozen_string_literal: true require "yaml" require_relative "../test_helper" module DataWrangler module Formatter class BaseTest < Minitest::Test def setup end def teardown end def test_autofill config = books_config book = DataWrangler::Book::Base.new(xlsx_path...
true
6adea5875913fde4a871fa60661107a2d7b4c650
Ruby
refactorit/refactorit-redesign
/spec/models/concerns/slugable_spec.rb
UTF-8
801
2.703125
3
[]
no_license
require 'rails_helper' describe Slugable do let(:dummy_metaclass) { Class.new { include Slugable } } let(:instance) { dummy_metaclass.new } it "returns correctly slugified text" do text = "This is a rails 5 text" expect(instance.slugify(text)).to eq "this-is-a-rails-5-text" end it "returns correctl...
true
eed5a817e75b10ae5dc006f9d157517970423060
Ruby
SOUP-KMITL/projectx
/lib/attack_graph/active_node/base.rb
UTF-8
4,827
2.515625
3
[ "Apache-2.0" ]
permissive
require 'httparty' require 'active_support/hash_with_indifferent_access' module AttackGraph class SessionError < StandardError; end module ActiveNode class Base include HTTParty # FIXME: base_uri 'localhost:9292' DEFAULT_SID = 1234 @@session_id = DEFAULT_SID attr_reader :...
true
930df8dee36d99afe345454955d72f08058a5643
Ruby
kkburr/homework_assignments
/objects_tdd/lib/cash_register.rb
UTF-8
379
3.5
4
[]
no_license
#!/usr/bin/env ruby class Register def initialize @total = 0 end def total @total.round(2) end def purchase(number) puts @total += number self end def pay(number) @total -= number if @total > 0 puts "Your new total is $#{total}" elsif @total < 0 puts "Your change is...
true
8dbd4b59343d13ab9497130a9e37e008bb7f9d74
Ruby
opandeW/ruby
/head_first_ruby1/09_chapter9/exercise.rb
UTF-8
440
3.15625
3
[]
no_license
module JetPropelled def move(destination) puts "Flying to #{destination}." end end class Robot def move(destination) puts "Walking to #{destination}." end end class TankBot < Robot include JetPropelled def move(destination) puts "Rolling to #{destination}" end end class Hoverbot < Robot include JetProp...
true
ca22008d9e08a1c2a014879434f658a5470f8dde
Ruby
willg1/ttt-10-current-player-oc-000
/lib/current_player.rb
UTF-8
796
3.890625
4
[]
no_license
board = [" ", " ", " ", " ", "X", " ", " ", " ", " "] def turn_count(board) count = 0 counter = 0 board.each do|n| if board[count] == " " || board[count] == "" puts "Board is empty" else board[count] == "X" || board[count] == "O" puts "Board Position #{count} is filled " + " Counter number is...
true
c1509b8dd5c779ed6265c2a7a64596a4c913e5f3
Ruby
nikoklein/meatup2
/app/models/animal.rb
UTF-8
2,142
2.875
3
[]
no_license
# == Schema Information # # Table name: animals # # id :integer not null, primary key # animal_type :string(255) # name :string(255) # breed :string(255) # weight :integer # host :string(255) # photo :string(255) # created_at :datetime not null # update...
true
dd5be99a63801cb7ccb5f8f3ca682fe82dbe5c59
Ruby
khoifishpond/final_2107
/lib/auction.rb
UTF-8
1,207
3.203125
3
[]
no_license
require 'date' class Auction attr_reader :items, :date def initialize @items = [] @date = Date.today.strftime("%d%m%Y") end def add_item(item) @items << item end def item_names @items.map do |item| item.name end end def unpopular_items @items.select do |item| ite...
true
d28c8c563bd374696e106b53ed8a62f00d1b8175
Ruby
J-Y/RubyQuiz
/ruby_quiz/quiz53_sols/solutions/Daniel Sheppard/array_sync_enum.rb
UTF-8
669
3.5625
4
[ "MIT" ]
permissive
#Oh, I love you SyncEnumerator, but you're just so impractically slow. A quick test suggest this is about 10,000 times faster. YMMV #Works as long as the shortest of the two arguments responds to [] in the same way as an array and both enums respond to size() #(if both enums are the same length, pass in the array first...
true
ab9ccf89df403c1ad9bfc5c76b776a030aa51941
Ruby
cxn03651/write_xlsx
/lib/write_xlsx/shape.rb
UTF-8
9,081
2.546875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# -*- coding: utf-8 -*- # frozen_string_literal: true module Writexlsx ############################################################################### # # Shape - A class for writing Excel shapes. # # Used in conjunction with WriteXLSX. # # Copyright 2000-2012, John McNamara, jmcnamara@cpan.org # Conve...
true
37cd9b0a9dac3d969202b873865cb3c7037630f7
Ruby
padwasabimasala/rakerunner
/lib/rakerunner/daemonlib.rb
UTF-8
6,793
3.203125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # daemonlib.rb is based off of http://snippets.dzone.com/posts/show/2265 # # FEATURES # ======== # - daemonizes a process (redirects STDIN, STDOUT, STDERR) # - catches TERM signal and calls "shutdown" code before dieing # - writes pid to file # - logs to log file # - supports reading and writing me...
true
a4c52590d55b60af1a1473ab4c817abd70149e79
Ruby
deanban/Ruby_problems
/seeingisbeli_test1.rb
UTF-8
26
2.578125
3
[]
no_license
10.times do |i| i * 2 end
true
4aa07e19e2c7df0727676047c5fea7d5f1c5f4c0
Ruby
sravangajula-copart/Ruby-Sinatra-SampleApp
/services/comments_list_by_topic_service.rb
UTF-8
1,273
2.59375
3
[]
no_license
class CommentsListByTopicService def initialize(params) @params = params @errors = {} @response = {} end attr_reader :params, :errors, :response def validate # validation errors[:user] = "User doesn't exist" if user.blank? errors[:user_not_admin] = "User is doesn't Admin" if !admin_us...
true
61f06f0dce91b8a2d1cffd843c79f97db09d9840
Ruby
alexchenjh/gitstudy
/ruby/test07func.rb
UTF-8
365
3.671875
4
[]
no_license
def sumx x,y return x,x + y end print sumx(10,11)[0] def alext x,y,z=1 return x,y,z,x+y+z end print alext(1,2,3) def alexmax(first,*rest) max = first rest.each {|x| max=x if x > max} max end print alexmax(1,2,3,4,5,6,7) puts "-------" def alexproc puts "begin other" p = Proc.new {puts "in inner";retu...
true
fa0ac5c67bdca9d8b73df5fad435813f296f11eb
Ruby
MichaelLenghel/ruby_testing
/c2fin.rb
UTF-8
249
4.03125
4
[ "MIT" ]
permissive
puts "Reading Celsius temp value from data file..." num = File.read("temp.txt") celsius = num.to_i fahrenheit = (celsius * 9 / 5) + 32 puts "The number is " + num # print has no new line character, unlike puts print "Result: " puts fahrenheit
true
62f4fdc6a6778a6fe90e347df3af8939d5e36bfc
Ruby
alyssabiot/prium-library
/app/controllers/bookings_controller.rb
UTF-8
1,072
2.546875
3
[]
no_license
class BookingsController < ApplicationController def index @bookings = Booking.all @booking = Booking.new end def new @booking = Booking.new() @users = User.all # a booking can only be made for available books @books = Book.available end def create @booking = Booking.new(booking...
true
35c813c7ae51d9cf7084db8416a8c7e70b5b2842
Ruby
salgadobreno/dme
/test/core/spec_test.rb
UTF-8
3,538
2.53125
3
[]
no_license
require 'test_helper' require 'date' describe StateMachine, "Maintenance interaction cycle definition" do let(:payload) { {} } let(:add_index_op) { lambda { |x| x[:index] ||= 0 x[:index] += 1 } } let(:even_validation) { lambda { |x| if x[:index].even? true els...
true
781c3411c61d6248ef03c3ae0d10b6b10b50ca8f
Ruby
daxadax/mtg
/lib/api.rb
UTF-8
1,702
2.5625
3
[]
no_license
module Mtg class Api include AppHelpers attr_reader :errors def self.get_requested_sets(sets) new.get_requested_sets(sets) end def self.get_prices(sets) new.get_prices(sets) end def initialize @errors = Array.new end def get_requested_sets(sets) sets.fla...
true
08dd4899f4708a07a4395bca012d8ec1c2f5e548
Ruby
clearhaus/pan
/spec/pan_spec.rb
UTF-8
3,311
2.828125
3
[ "MIT" ]
permissive
require_relative '../lib/pan.rb' describe 'Pan#mask' do it 'default template' do expect(Pan.mask('')).to eq '' expect(Pan.mask('1')).to eq '1' expect(Pan.mask('12')).to eq '12' expect(Pan.mask('123')).to eq '123' expect(Pan...
true
8e7eca6c652029c751e0d8deca54c23cdbbceb5c
Ruby
GrantjHanrahan/wdi27-homework
/Anastasia_Gorodinskaya/week04/calculator.rb
UTF-8
799
3.71875
4
[]
no_license
require 'pry' require 'colorize' def add(a, b) puts "ADDING #{a + b}" a + b end def sub(a, b) puts "SUBTRACTING #{a - b}" a - b end def mul(a, b) puts "MULTIPLYING #{a * b}" a * b end def div(a, b) puts "DIVIDING #{a / b}" a / b end def exp(a, b) puts "EXPONENT" a ** b end def quit( ignore, al...
true
adfab31ce34ca7faf74c53f24782a2dfc8cd69fb
Ruby
cdas/contest
/contest.rb
UTF-8
776
2.65625
3
[]
no_license
require 'rubygems' require 'sinatra' require 'json' class Message < Hash def initialize data if data.is_a? Hash data.each do |key, value| self[key] = value end else self["msg"] = "Error: Wrong data input" end end end def respond_on msg if not msg["msg"] == "error" return std_result = {:msg =...
true
3516e81e2dae2355c03137417ca0b19c493971ae
Ruby
ckccameron/sweater_weather_api
/spec/poros/weather_spec.rb
UTF-8
3,787
2.671875
3
[]
no_license
require 'rails_helper' describe Weather do before :each do @data = { :current_weather=> { :conditions=>"few clouds", :datetime=>"2020-11-10, 09:37", :feels_like=>24.12, :humidity=>68, :icon=>"http://openweathermap.org/img/wn/02n.png", :sun...
true
e7439c538c3aaae1f5c8f152d9f9d385effda0ba
Ruby
ryanberckmans/NoricMud
/lib/noric_mud.rb
UTF-8
2,920
2.859375
3
[]
no_license
require 'thread' require_relative 'noric_mud/util' require_relative 'noric_mud/log' require_relative 'noric_mud/easy_class_log' require_relative 'noric_mud/player/sessions' require_relative 'noric_mud/network/server' module NoricMud extend EasyClassLog LOG_LEVEL = Logger::DEBUG TICK_DURATION = 0.125 # in sec...
true
84511d64fd1c782ae81b5906171dca4bff4c243a
Ruby
cbm585/hello-ruby
/learn/5.rb
UTF-8
150
3.296875
3
[]
no_license
# Run the code in this file by typing: # ruby 5.rb # into your command-line interface. friends = ["Ben", "Brian", "Nathan"] puts "Hey, #{friends[0]}"
true
3c618ba2b13cb1e79a749115d4f3222fe360c9b4
Ruby
CalebJR05/square_array-online-web-sp-000
/square_array.rb
UTF-8
143
3.4375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def square_array(array) squared_numbers = [] array.each do |number| squared_numbers << number ** 2 end return squared_numbers end
true
4aefea5621a21cf5e850548c7a330fd07f75dc95
Ruby
textchimp/sei35
/week4/databases/animals-orm-site/server.rb
UTF-8
4,621
3.09375
3
[]
no_license
require 'sinatra' require 'sinatra/reloader' require 'sqlite3' # to talk to our SQL database require 'pry' require 'active_record' ActiveRecord::Base.establish_connection( adapter: 'sqlite3', # What is the DB system we are using? database: 'database.db' # Where is the actual DB data? ) # Log out all the SQ...
true
674d025e150f9b616ff7b384bc18a22d39cce251
Ruby
slashdotdash/ledger-import
/lib/ledger_writer.rb
UTF-8
842
3.265625
3
[]
no_license
# encoding: utf-8 class LedgerWriter def initialize(transactions) @transactions = transactions @number_formatter = NumberFormatter.new end # # 2013/01/01 Payment for INVOICE1 # Assets:Current Account £1,200.00 # Assets:Accounts Receivable # def to_s builder = [] @transact...
true
4063ceaa0128e1cfc00afe609e6e7ae4ebf0ac62
Ruby
superposition/Research
/ruby/binsearch.rb
UTF-8
423
3.9375
4
[]
no_license
#!/usr/bin/ruby =begin Implement binary search of a sorted array of integers =end def binary_search(array, key, low=0, high=array.size-1) return -1 if low > high mid = (low + high) / 2 return mid if array[mid]==key if array[mid] > key high = mid - 1 else low = mid + 1 end bin...
true
c9592380e3faf08a530067ded7bfe54abadbc076
Ruby
razorinc/fata-morgana
/test/functional/support/httpd.rb
UTF-8
3,310
2.53125
3
[]
no_license
# # A tiny web server in ruby for functional testing # # Originally by Abhinaba Basu (2005) # http://blogs.msdn.com/b/abhinaba/archive/2005/10/14/474841.aspx # require 'socket' class HttpServer def initialize(session, request, basePath) @session = session @request = request @basePath = basePath end ...
true
ef75979fec1497ed03c5a4142d6ef9b8a782d275
Ruby
thehuff/7langs
/ruby/day_02_find_01-04.rb
UTF-8
1,668
3.984375
4
[]
no_license
#!/usr/bin/env ruby # Exercises in the Find section of Ruby day two. # 1 # Access a file with a code block. puts 'contents of file (with block):' File.open('./dummy.txt') do |f| puts f.read end puts "\n" # Access a file without a code block. puts 'contents of file (sans block):' begin file = File.open('./dummy....
true
a4f4c8b1377d200382ebf402ac1a291fec60e974
Ruby
charlie-galb/oyster_2
/spec/journey_spec.rb
UTF-8
748
2.53125
3
[]
no_license
require 'journey' require 'oystercard' describe Journey do let(:mock_entry) { double("fake entry station")} let(:mock_exit) { double("fake exit station")} let(:card) { Oystercard.new } subject(:journey) { Journey.new(mock_entry)} before do card.top_up(50) end it "is created on touch in" do expe...
true
c8489fa96e1dd0b092c2e54b90689927ae5a6df5
Ruby
DANIELROCHA1990/chordz_2021
/triad_chords_formation/diminished_triad_chords_formation.rb
UTF-8
631
2.71875
3
[]
no_license
module Notes class DiminishedTriadChordFormation < TriadScale DIMINISHED_TRIAD_CHORD_PATTERN = [0, 3, 6].freeze # Tonica-terça menor-quinta menor def self.by_note(note) diminished_chord_index = index_of_mode(note) DIMINISHED_TRIAD_CHORD_PATTERN.map do |diminished_chord_interval| # Interação com a ...
true
08054ae230a62eb51d121674af27fc5caba4e76f
Ruby
nabilhayet/ruby-objects-has-many-through-lab-onl01-seng-pt-032320
/lib/patient.rb
UTF-8
684
3.1875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Patient attr_accessor :name @@all=[] def initialize(name) @name = name @@all << self end def self.all @@all end def new_appointment(date,doctor) ## creates a new Appointment. The Appointment should know that it belongs to the patient. Appointment.new(date,self,doct...
true
5ed622ca54e48c592c93e1b78461c19b32cb1bd1
Ruby
PhilippePerret/Analyses_With_VLC
/spec/support/required/VLC/VLC_matchers.rb
UTF-8
611
3.25
3
[]
no_license
# encoding: UTF-8 # frozen_string_literal: true =begin Matchers pour VLC =end class VLC class << self # # Pour la formule : # # expect(VLC).to be_playing # def playing? return eval(vlc("return playing").strip) == true end # # Pour la formule : # # expect(VLC).to have_current_time(<time>) # ...
true
a862cf336ae39b8eebc08a45931e29c2ecbab166
Ruby
kassHa/phase-0-tracks
/ruby/hashes.rb
UTF-8
1,530
4.28125
4
[]
no_license
# First create a hash # Ask user for the input # Convert input to appropriate data type (integers, booleans) # When application is finished, print it to the screen # Use the if statement to find out if the user made a mistake, and wants to update it. # If user wants to update the input, and ask which label/key needs to...
true
5d9dbeeb565ec6887f99ee22e4a901a5b755d22a
Ruby
danpospisil/RuMax
/lib/rucube/cli.rb
UTF-8
1,944
2.75
3
[]
no_license
#!/usr/bin/env ruby require 'trollop' require 'rucube/cube' require 'rucube/network' module RuCube class CLI def initialize(_args) @network = Network.new(true) opts = Trollop::options do opt :discover, 'Find a Cube on network' opt :connect, 'Connect to a Cube' opt :ip, 'Addres...
true
eee1f22a758e0754b6f7bb8a7ab480756516c72e
Ruby
caelum/buggie
/lib/buggie.rb
UTF-8
2,457
2.53125
3
[ "MIT" ]
permissive
require 'pivotal-tracker' module Caelum module Buggie end end class Caelum::Buggie::Iteration def initialize(project, p) @project = project @iteration = p end def closed_bugs @iteration.stories.select do |story| (story.story_type == "bug" && story.current_state == "accepted") end.size ...
true
e0a71e87a15994aa38acbd630124faf5e45d1b08
Ruby
petevdp/jungle-rails
/spec/models/user_spec.rb
UTF-8
1,981
2.625
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do valid_inputs = { email:'lmao@gmail.com', password:'lmao', password_confirmation: 'lmao', first_name: 'lm', last_name: 'ao' } describe 'Validations' do it 'is valid with valid inputs' do user = User.create(valid_inputs) ...
true
99e366c715041b860016e3de84793906e8c5be61
Ruby
lweinhard/jobs
/backend/level1/main.rb
UTF-8
322
2.640625
3
[]
no_license
require './loader.rb' def main output = {} hash = parse_from_json_input cars = CarFactory.generate(hash["cars"]) rentals = RentalFactory.generate(hash["rentals"]) price_calculator = PriceCalculator.new(cars, rentals) output["rentals"] = price_calculator.compute_prices write_output_to_file(output) end ma...
true
e4fe20a74bf92829ea0506a339fb4ad3d634b6c6
Ruby
akowalz/csv_analysis_tool
/test/tc_money.rb
UTF-8
1,486
2.90625
3
[]
no_license
require "../analyze_money.rb" require "test/unit" class TestMoneyAnalysis < Test::Unit::TestCase HIST = BankHistory.new('./testhist.csv') def test_find_totals_with_description assert_equal(-21.0, HIST.sum_with_requirements(description: "location 1")) assert_equal(-67.0, ...
true
34b6373fb99cb6bed3340959f2f4595247b586a8
Ruby
AngelusProductions/launch-academy-coursework
/Command Line/combining-words/code.rb
UTF-8
452
3.296875
3
[]
no_license
#Your code here larry = "Coding " manny = "is " cody = "the " susie = "freaking " samantha = "worst. " kendall = "Why " christobal = "would " jamal = "anyone " bennie = "choose " thejets = "to " duncan = "do " rumpelstilskin = "this " carmen = "for " dingus = "a " corey = "living?" puts "#{larry}#{manny}#{cody}#{sus...
true
18abb6e5d8a1f837a51651568e49f9d85977d47e
Ruby
gs-kl/w3-blackjack
/lib/card.rb
UTF-8
445
3.359375
3
[]
no_license
module BlackJack class Card def initialize(suit, face) @suit = suit @face = face end def suit @suit end def face @face end def values if @face.match(/\d/) [@face.to_i] elsif @face.match(/A/) [1, 11] elsif @face.match(/[JQK]/) ...
true
ac43988485436d08a5d0109e2bd6afccda83f0de
Ruby
sdhull/git_tracking
/lib/git_tracking/detect.rb
UTF-8
1,052
2.53125
3
[]
no_license
class GitTracking class << self def detect_debuggers file_names = `git diff-index --cached -Sdebugger --name-only HEAD` file_names = file_names.gsub(".git_tracking",'').strip if file_names != "" highline.say highline.color("The following files have 'debugger' statements in them: ", :red)...
true
dd4fa5e7f5c8529087757ac8ca0bd2767d51f0d5
Ruby
mikeappell/ruby2d
/spec/color_spec.rb
UTF-8
1,007
2.765625
3
[ "MIT" ]
permissive
require 'ruby2d' RSpec.describe Ruby2D::Color do describe '#is_valid?' do it 'determines if a color string is valid' do expect(Ruby2D::Color.is_valid? 'red').to eq true expect(Ruby2D::Color.is_valid? 'balloons').to eq false end it 'determines if an array is a valid color' do exp...
true
44b4f4bd2a0b2d134e3c64e38d1ed344911963f7
Ruby
consumerike/bloccit
/db/seeds.rb
UTF-8
1,043
2.65625
3
[]
no_license
require 'random_data' #create users 5.times do User.create!( name: RandomData.random_name, email: RandomData.random_email, password: RandomData.random_sentence ) end users = User.all # Create Topics 15.times do Topic.create!( name: RandomData.random_sentence, desc...
true
29a8de7a7a67f9a54c4d7315e5ef4da1cbb5319f
Ruby
alexbeeken/mr_beeken_codes_ruby_intro
/examples/episode3/operators9.rb
UTF-8
36
2.578125
3
[]
no_license
number = 5 puts number puts 5 == 5
true
de544ffe58c10c47cd5e1c9e7d2f3aa96b362bad
Ruby
sent-hil/peak
/lib/peak/algorithms/algorithms.rb
UTF-8
381
2.5625
3
[]
no_license
module Peak module Algorithms class << self def rise_drop_common(name, data, &blk) last = data.pop deviation = data.std_dev result = if deviation == 0 last == data[-1] ? false : true else blk.call last, deviation end Response.new(name, re...
true
16fec21ff44058de466ccbb40b454a1d04bbb7ce
Ruby
LucasBarbara/enumerable_methods
/enumerable_methods.rb
UTF-8
1,587
3.59375
4
[]
no_license
module Enumerable def my_each self.length.times do |i| yield(self[i]) end end def my_each_with_index i = 0 while i < self.length yield(self[i], i) i += 1 end end def my_select new_array = [] self.my_each do |element| new_array << elemen...
true
5eb70be081075150ccef8077cbf5541ddcef0ea7
Ruby
chuyeow/myanimelist-api
/my_anime_list/manga_list.rb
UTF-8
2,690
2.734375
3
[]
no_license
module MyAnimeList class MangaList attr_writer :manga def self.manga_list_of(username) curl = Curl::Easy.new("http://myanimelist.net/malappinfo.php?u=#{username}&status=all&type=manga") curl.headers['User-Agent'] = ENV['USER_AGENT'] begin curl.perform rescue Exception => e ...
true
d69e076cd9c593549eb2f53b2e0e96218ee2733d
Ruby
railapp/railapp
/vendor/plugins/assert_request/lib/method_rules.rb
UTF-8
924
2.875
3
[ "MIT" ]
permissive
# assert_request Rails Plugin # # (c) Copyright 2007 by West Arete Computing, Inc. require 'request_error' module AssertRequest # Defines how we handle and validate the request method. class MethodRules #:nodoc: attr_reader :requirements def initialize @requirements = [] end # Add ...
true
2e9c8eb3c196fecdd6f6ecf2c9085119bd5e4167
Ruby
qx-redes/CloudCDN
/StreamBalance/benchmark/exec-no-sound.rb
UTF-8
1,616
2.859375
3
[]
no_license
#!/usr/bin/ruby def nextTime(rateParameter) return - Math.log(1.0 - rand) / rateParameter end def defRate(clientes) # quantidade de clientes a cada 5 minutos return 1.0 / (300.0 / clientes) # return 1.0 / (3600.0 / clientes) end def run(nroclientes) rate = defRate(nroclientes) videos = ...
true
e4be95db15a41d5b3e4fb0a62c370e8ba9169f34
Ruby
ericmwalsh/carne-asada-sidekiq
/app/workers/base_volumes_s3_worker.rb
UTF-8
1,055
2.546875
3
[]
no_license
# ::BaseVolumesS3Worker class BaseVolumesS3Worker < ::BaseWorker sidekiq_options :queue => 'extract', :retry => 2 def perform # query from db # push to aws timestamp = Time.now.to_i mapped_volumes = [ [ 'symbol', 'base_volume', 'quote_volume', 'timestamp' ...
true
1ab09fe8bfd4fa8ebd72310f2294724c952a961e
Ruby
FundingGates/harvest
/lib/harvest/response_parser.rb
UTF-8
2,473
2.53125
3
[ "MIT" ]
permissive
require 'active_support/core_ext' require_relative './error/harvest_error.rb' require_relative './error/http_error.rb' require 'pp' module Harvest module ResponseParser class << self def parse(response_status, response_headers, response_body, options = {}) content_type = response_headers.fetch("CO...
true
301be145c510b2b8903d2ff12758d98377b0d484
Ruby
paolodona/codility
/lib/perm_check.rb
UTF-8
232
2.890625
3
[ "MIT" ]
permissive
module PermCheck def solution(a) n = a.size counts = [] n.times do |i| x = a[i] return 0 if x > n return 0 if !counts[x].nil? counts[x] = true end counts.size == n + 1 ? 1 : 0 end end
true
03f6c750b99f43c4f9535a6401fdd13471bc128d
Ruby
dreamhead/rbits
/spec/rbits/rbits_spec.rb
UTF-8
1,571
2.921875
3
[]
no_license
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') class RBitsTestClass include RBits u1 :first u1 :second u1 :third end describe RBits do before(:each) do @bits = RBitsTestClass.new @io = StringIO.new end it 'adds getter and setter' do @bits.first = 1 @bits.fir...
true
4cd7e947ac43dd8e2fe0ba3c454acfb8500ebf90
Ruby
Justafigurehead/hogwarts_database
/db/seeds.rb
UTF-8
656
2.96875
3
[]
no_license
require_relative('../models/Student') require_relative('../models/House') require ('pry-byebug') house1 = House.new("house_name" => "Gryffindor") house2 = House.new("house_name" => "Slytherin") house3 = House.new("house_name" => "Hufflepuff") house4 = House.new("house_name" => "Ravenclaw") house5 = House.new("house_na...
true
fc73b2a2c34a1bbcb0f345bf408b7b1d40a097d5
Ruby
robopro/exercism
/ruby/pythagorean-triplet/pythagorean_triplet.rb
UTF-8
546
3.515625
4
[]
no_license
class Triplet def initialize(a, b, c) @a, @b, @c = a, b, c end def sum a + b + c end def product a * b * c end def pythagorean? a < b && b < c && a ** 2 + b ** 2 == c ** 2 end def self.where(sum: nil, min_factor: 1, max_factor:) min_factor.upto(max_factor).to_a.combination(3).e...
true
f7974fcd1520b544f016d9b52b6d75e526fe1aa4
Ruby
naorespawn/rubybook
/chapter_03/chapter_3-6/3times4.rb
UTF-8
101
2.53125
3
[]
no_license
3.times do puts "モカ" puts "ください" end 3.times {puts "カフェラテください"}
true
1bfc9dc74695166e2a83debe6b443ba61a9ddcef
Ruby
ruby/typeprof
/lib/typeprof/code-range.rb
UTF-8
4,672
2.859375
3
[ "MIT" ]
permissive
module TypeProf class CodeLocation # In Ruby, lineno is 1-origin, and column is 0-origin def initialize(lineno, column) @lineno = lineno @column = column end def inspect "(%d,%d)" % [@lineno, @column] end attr_reader :lineno, :column def self.from_lsp(lsp_loc) # ...
true
6c639c08a1cfe2c97d176a5f050c4de1d2a36dbe
Ruby
puppetlabs/beaker-puppet
/lib/beaker-puppet/install_utils/puppet_utils.rb
UTF-8
10,375
2.703125
3
[ "Apache-2.0" ]
permissive
module Beaker module DSL module InstallUtils # # This module contains methods useful for both foss and pe installs # module PuppetUtils # Given a type return an understood host type # @param [String] type The host type to be normalized # @return [String] The normali...
true
a9f0ad255258b2971cdb8b247fa7e477d8ca5af4
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/difference-of-squares/79abeb86b8c342e9953678b8e00f7983.rb
UTF-8
249
3.546875
4
[]
no_license
class Squares def initialize(n) @num = n end def square_of_sums (1..@num).reduce(:+).**2 end def sum_of_squares (1..@num).inject(0){|sum, n| sum + (n**2)} end def difference square_of_sums - sum_of_squares end end
true
75de14a0da5c41b1c3ea14fe4f4dda17ee9e094d
Ruby
OneWhoFrogs/BigFriendlyRobot
/subreddits.rb
UTF-8
3,199
3.015625
3
[]
no_license
class Subreddit attr_accessor :name, :regex, :css, :moderators, :format Banned_words = [] def initialize end def valid?(input) def clean?(input) Banned_words.each do |word| if input.include?(word) return false end end true end input == input.match(...
true
77659b69f38f05f3a05e26695ac7381da7c07083
Ruby
justineyeahyeah/programming-exercise
/21-selection-sort.rb
UTF-8
929
4.4375
4
[]
no_license
# 给定一数组内含数字,请实作选择排序法进行排序。 # https://zh.wikipedia.org/wiki/选择排序 # 假设数组有N个元素,先从第一个元素走访到最后一个,找到最小的那一个交换到第一个位置。 # 接着从第二个元素走访到最后一个,找到最小的元素,交换到第二个位置。以此类推,最后就会得到一个从小到大的数组。 def insertion_sort(arr) size = arr.size for i in 0..size for j in (i+1)..size # j > i if arr[j-1] < arr[i-1] # 比较j-1位置和i-1位置的元素大小 ...
true
ed058569419449345897ae7ddf32e65dbf6b0a0d
Ruby
ssciolist/hash_table
/test/hash_table_test.rb
UTF-8
1,063
3.078125
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/hash_table.rb' class HashTableTest < Minitest::Test def test_it_can_initialize_with_size ht = HashTable.new(10) end def test_it_can_put ht = HashTable.new(10) ht.put('Janice', 5) assert_equal ht.array[6].value["Janice"], 5 end...
true
0966ec818323a8110cd1ce66ef6e607fb3e49cf2
Ruby
aasimalee/my_books
/Full Stack Web Developer/11 - Programming with Ruby/19 - exceptions/exercises-and-code/exception-3.rb
UTF-8
292
3.90625
4
[]
no_license
# File: exception-3.rb # def raise_if_not_integer(number) unless number.is_a?(Integer) raise ArgumentError.new("#{number} has to be an Integer but it is not.") end end def add_integers(a, b) raise_if_not_integer(a) raise_if_not_integer(b) a + b end puts add_integers(5, 7.3)
true
4b68d741e616b8ef2b0bedf17f22e8ee303630ef
Ruby
angethuy/ride-share
/rideshare.rb
UTF-8
2,920
3.421875
3
[]
no_license
# RIDESHARE # Calculates statistics of rideshare data. drivers = { DR0001: [ { "3rd Feb 2016": [ { cost: 10, rider_id: "RD0003", rating: 3, }, { cost: 30, rider_id: "RD0015", rating: 4, }, ], }, { ...
true
4006e0cd4b9d133945608d4c74be9d4f00a14781
Ruby
crowlebf/blackjack
/lib/card.rb
UTF-8
194
3.25
3
[]
no_license
require 'pry' class Card attr_accessor :card def initialize(suit, rank) @card = "#{rank}#{suit}" end def face_card? face_card = ["K", "Q", "J"] face_card.include?(@card[0]) end end
true
746fc8927cf9695452cbeebf73073d08eb170591
Ruby
jukinner/Coding-Practice-Codewars-Codility-Hackerrank-etc.-
/Happy_numbers_Code_wars.rb
UTF-8
1,364
4.34375
4
[]
no_license
# A happy number is a number defined by the following process: starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. # Those numbers for which this...
true
7b36d201e72b17e453f54e727a310cc6b9939c99
Ruby
narensh/bulk-import
/app/helpers/policies_helper.rb
UTF-8
566
2.578125
3
[]
no_license
module PoliciesHelper def self.fetch_or_persist(company_id, names) names.map do |name| Policy.find_or_create_by({name: name, company_id: company_id}) end end def self.fetch_policies(all_policies, required_policy_names) required_policies = [] names_to_array(required_policy_names).map do |re...
true
33548624e2d62d13a52612725f361a12a9ae4430
Ruby
lukeclewlow/till_tech_test
/app/lib/adjustments.rb
UTF-8
820
3.15625
3
[]
no_license
class Adjustments attr_reader :discount_threshold, :discount_rate, :item_discount_rate, :item_on_discount def initialize @discount_threshold = 50 @discount_rate = 0.95 @item_on_discount = "Muffin" @item_discount_rate = 0.90 end def discount(order_subtotal) if order_subtotal >...
true
85b45a309b04ea37a8f0139ae7a73827f8a240a0
Ruby
mhyee/wishlist
/spec/models/user_spec.rb
UTF-8
2,778
2.609375
3
[ "MIT" ]
permissive
require 'spec_helper' describe User do before(:each) do @attr = { :name => "Foo S. Bar", :username => "foobar", :password => "foobarpassword", :password_confirmation => "foobarpassword" } end it "should create a new instance given valid attributes" do User.create!(@attr) e...
true
0dcce6ede40a18c9eb0843d70da769e352c115b6
Ruby
Brennan-Flood/Classwork-AppAcademy
/w6d3/chess_part_1/pieces/null_piece.rb
UTF-8
236
2.859375
3
[]
no_license
require_relative 'piece' require 'singleton' class NullPiece < Piece include Singleton def initialize end def empty? true end def moves raise 'NullPiece piece has no moves' end def symbol " " end end
true
b4ff6cbfafa329907df5ac6436a2a0c066e61309
Ruby
michael-huang/Basic-Ruby
/Week2/blackjack_oop.rb
UTF-8
4,148
3.90625
4
[]
no_license
class Cards attr_accessor :suit, :value def initialize(suit, value) @suit = suit @value = value end def to_s "The #{value} of #{suit}" end end module Hand def show_cards puts "---- #{name}'s cards ----" cards.each{ |card| puts "#{card}"} puts "Total = #{total}" end def total arr = cards.map{|...
true
63e1bdc87f877b539b8d5ef69e023b4a2b5d4e86
Ruby
CootCraig/rmu_2011-t1-exam
/print_schedule.rb
UTF-8
895
2.75
3
[]
no_license
require './rmu_roster' roster = RmuEntranceExam::RmuRoster.new roster.build_possible_schedules_sorted roster.print_day_roster("monday-roster.txt", roster.possible_schedules_sorted[-1].monday_time_24_hour, roster.possible_schedules_sorted[-1].monday_student_list) roster.print_day_roster("wednesday-roster.txt", ros...
true
1fa860452ffc2c501a97991de32d0fcee0089b55
Ruby
ckagana/LaunchAcademy-Challenges
/emergency-brussels-sprouts/lib/container.rb
UTF-8
649
3.765625
4
[]
no_license
class Container attr_reader :weight, :maximum_holding_weight, :ingredients def initialize(weight, maximum_holding_weight) @weight = weight @maximum_holding_weight = maximum_holding_weight @ingredients = [] end def fill_with_ingredient(ingredient) fill = 0 while fill < @maximum_holding_we...
true
17db907bea4d01033084b7518174a77329ed8a75
Ruby
oppnabibliotek/oppnabibliotek
/app/models/role.rb
UTF-8
810
2.515625
3
[ "MIT" ]
permissive
# -*- encoding : utf-8 -*- # This code is licensed under the MIT license (see LICENSE file for details) # == Schema Information # Schema version: 55 # # Table name: roles # # id :integer(4) not null, primary key # name :string(255) # class Role < ActiveRecord::Base include Comparable has_and_belongs_to...
true
fcb5602462e80732814f37ee3630ce251e80fe0e
Ruby
DimitarVashkov/ruby-music-library-cli-cb-gh-000
/lib/music_importer.rb
UTF-8
252
2.890625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class MusicImporter attr_reader :path, :files def initialize(path) @path = path end def files files ||= Dir["#{@path}/*.mp3"].collect{|x| x.sub("#{@path}/",'')} end def import files.each do |x| Song.create_from_filename(x) end end end
true
937e482f1c7e97d5e3a5f13469fdd64e2567eeed
Ruby
dborski/black_thursday_lite
/runner.rb
UTF-8
619
2.671875
3
[]
no_license
require 'CSV' require './lib/sales_engine' require './lib/merchant' require './lib/merchant_collection' require './lib/item' require './lib/item_collection' sales_engine = SalesEngine.from_csv({ :items => "./data/items.csv", :merchants => "./data/merchants.csv" }) merchant_collection = sales_engine.merchants ...
true
9dcddc16e4b53f60c11af7cabd6f57b6a221f1bb
Ruby
postazure/Ruby-Practice
/Second Run/CH11_YAML-Improved.rb
UTF-8
461
3.203125
3
[]
no_license
#Chapter 11 YAML Improved require 'yaml' def yaml_save object, filename File.open filename, 'w' do |f| f.write(object.to_yaml) end end def yaml_load filename yaml_string = File.read(filename) YAML::load yaml_string end test_array = ["Stuff here", 'Stuff there', 'Stuff Everywhere!!!!'] filename = 'LotsO...
true
4f8ed1763784aabcecf980231e4bd23942c8063b
Ruby
krismacfarlane/godot
/w02/d04/instructor/tmnt/main.rb
UTF-8
459
2.8125
3
[]
no_license
require 'pry' require_relative 'modules/teenageable' require_relative 'modules/ninjable' require_relative 'modules/mutatable' require_relative 'classes/human' require_relative 'classes/turtle' leo = Turtle.new leo.name = "Leonardo" raph = Turtle.new raph.name = "Raphael" foot_soldier_one = Human.new foo...
true
ba779a7981bf7582c31bb4e93bbaa35875c613e0
Ruby
AkaiTobira/Shingeki-no-Danjon---Remaster
/Resources/Tools/ItemList.rb
UTF-8
309
2.875
3
[]
no_license
require 'json' items = [] (Dir.entries("../Items") - [".", ".."]).sort{|entry1, entry2| entry1.rjust(8, "0") <=> entry2.rjust(8, "0")}.each do |file| item = JSON.parse(File.readlines("../Items/#{file}").join("\n")) puts "#{file.chomp(".json").rjust(3, " ")} -> #{item["name"]} (#{item["type"]})" end gets
true
8e09d82c5b6838fb3472501cc842dce088236e33
Ruby
simonbaire/automation_test
/lib/website/page/sign_in_page.rb
UTF-8
815
2.640625
3
[]
no_license
class Website::Page::SignInPage < Website::Page::BasePage set_url "#{Website::Site.instance.url}" element :email_address, '#email' element :password, '#passwd' element :sign_in_button, '#SubmitLogin' #sign in user with their user credentials #abort if the user object is not a hash or is empty def sign_...
true
07afa0ce65fa3280703ab226d7afbe2dcce62180
Ruby
LAdkins81/DojoAssignments
/Ruby/platform_projects/ruby_exercises/arrayex.rb
UTF-8
318
3.484375
3
[]
no_license
a = ["Laura", "Terry", "Katie", "Bob", "Yay!"] b = [1, 3, 55, 11, 13, 5, 6, 10, 8] c = ["Yay!", 55] # x = (a+b)-c # puts x.to_s # puts b.class # puts a.shuffle.join("-") # puts b.length # a.delete("Yay!") # puts a # puts a.fetch(4) # puts b.reverse # puts b.sort # b.slice!(6) # puts b puts a.insert(0, "Friends")
true
a725d0b595f93e62089af1546661d7e888009dbb
Ruby
COMPEON/compeon-access_token
/test/compeon/token/decoder_test.rb
UTF-8
7,048
2.53125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'test_helper' class Compeon::Token::DecoderTest < Minitest::Test PRIVATE_KEY = OpenSSL::PKey::RSA.new(512) class TestToken < Compeon::Token::Base class << self def required_attributes_mapping { attribute: :attr }.freeze end def optional_attribu...
true
73e53fa17e35dcc172db1f5cc06dabbbf75567f6
Ruby
vovka26/operators-prework
/lib/operations.rb
UTF-8
153
2.984375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def unsafe?(speed) if speed<40 || speed>60 true else false end end def not_safe?(speed) speed<40 || speed>60 ? true : false end
true
b09f8470dcb9fb652a6ded17c7339caf3b64b6b1
Ruby
Amoncio/geometry
/triangle.rb
UTF-8
618
3.96875
4
[]
no_license
class TriangleError < StandardError end class Triangle attr_reader :sides ERR_MSG = "That ain't a triangle, buddy.".freeze def initialize(sides) @sides = sides.map(&:to_f) raise(TriangleError, ERR_MSG) unless side_a.positive? && side_b.positive? && side_c.positive? end def area s = sides.sum /...
true
ccdc928bbd918aecd430ba19b0ba8f9740380007
Ruby
thelimberlambda/liquid39
/barcode.rb
UTF-8
9,178
2.84375
3
[ "MIT" ]
permissive
require 'Liquid' template = Liquid::Template.parse(%Q( <!DOCTYPE html> <html> <head><title>Barcode</title></head> <body> {% assign barcode_height = '1in' %} {% assign barcode_wide_width = '0.07in' %} {% assign barcode_narrow_width = '0.03in' %} {% capture wide_bar %}<span style="border-left: black {{ barco...
true
b37c005ed6c38048e25ceb657bd2e8911e6b418b
Ruby
lucasocon/ocar
/lib/ocar/client.rb
UTF-8
1,010
2.703125
3
[ "MIT" ]
permissive
require 'json' require 'typhoeus' module Ocar extend self TYPES = %w(cartas paquetes dni partidas).freeze $hydra = Typhoeus::Hydra.new def get_package(track_id) requests = setup_request(track_id) run_request get_response requests end private def setup_request(track_id) # e.g. http://w...
true
290e31251076970a9e4a2359489e819dd3cc61b2
Ruby
burrahey/forms-and-basic-associations-rails-lab-v-000
/app/models/song.rb
UTF-8
846
2.75
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song < ActiveRecord::Base belongs_to :artist belongs_to :genre has_many :notes def genre_name=(genre_name) genre = Genre.find_or_create_by(name: genre_name) self.genre = genre self.save end def artist_name=(artist_name) artist = Artist.find_or_create_by(name: artist_name) self.ar...
true
8d63eeee6ba4b7b2008a3ed937ecbb013d87675b
Ruby
cassiuschen/CommentSpider
/spiders/dianping.rb
UTF-8
4,723
2.71875
3
[]
no_license
require 'uri' require 'net/http' require 'json' require 'nokogiri' module Dianping @@export_folder = "./data/dianping-" RATING = { '4' => "Great", '3' => "Good", '2' => "Normal", '1' => "Bad", '0' => "White" } class << self def load(*words) @all = [] @shop_id = words.shift ...
true
bd6bc07c04a7bb7beb51c5eddf5bfbf827718f50
Ruby
Yorickov/black-jack
/lib/bank.rb
UTF-8
317
3.328125
3
[]
no_license
class Bank attr_accessor :desk, :bet def initialize(bet) @desk = 0 @bet = bet end def deposit(player) player.balance -= bet @desk += bet end def withdraw(player) player.balance += bet @desk -= bet end def take_all(player) player.balance += desk @desk = 0 end end
true
daee21d187e00e06d29eeb65966ae3c1e950ae0b
Ruby
chef/chef-server
/src/oc_bifrost/oc-bifrost-pedant/lib/pedant/command_line.rb
UTF-8
3,307
2.515625
3
[ "Apache-2.0", "LGPL-3.0-only", "CC0-1.0", "Apache-1.1", "CC-BY-3.0", "Artistic-2.0", "Artistic-1.0-Perl", "Zlib", "BSD-Source-Code", "SAX-PD", "MPL-2.0", "WTFPL", "BSD-3-Clause", "ISC", "BSD-1-Clause", "LicenseRef-scancode-unknown-license-reference", "Unlicense", "GPL-2.0-only", ...
permissive
# Copyright: Copyright (c) Chef Software, Inc. # License: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
true
fa73b4af0ae5b34da272fcfb71f360fef8fb1130
Ruby
fingersi/Ruby_lessons
/ruby_lesson2/array_from_10_to_100.rb
UTF-8
199
3.515625
4
[]
no_license
puts '' puts 'Заполнить массив числами от 10 до 100 с шагом 5' puts '' puts "Получившийся массив" (10..100).step(5).to_a.each{|index| puts index}
true
23e31fdb3130342defc6cbb64e8e172e78cdc65c
Ruby
ninesky00/backend_mod_1_prework
/day_2/exercises/iteration_and_each_lesson.rb
UTF-8
552
4.03125
4
[]
no_license
array = [1, 2, 3, 4] array.map! {|x| x * 2}# x * 3 print array puts array = [1, 2, 3, 4] array.each do |x| if x % 2 == 0 # x % 2 == 1 print x end end puts array = ["Alice Smith", "Bob Evans", "Roy Rogers"] initials=[] array.each {|x| puts x} array.map! {|x| x.split" "} array.each {|x| print x[0] + " "} puts ar...
true
3860a45d3fd3cf81cb3c1c52191294eadf180191
Ruby
stephenfung/eulerruby
/p009.rb
UTF-8
123
2.546875
3
[]
no_license
require './lib/functions' puts pythagorean_triplet_generator(1000).find { |a, b, c| a + b + c == 1000 }.inject(1, &:*)
true
cc7e71d698921fb8ac690cbf124c3d6495a02e8d
Ruby
rebeccaswebsite/advanced-hashes-hashketball-london-web-career-040119
/hashketball.rb
UTF-8
4,492
2.84375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" def game_hash { :home => { :team_name => "Brooklyn Nets", :colors => ["Black", "White"], :players => { "Alan Anderson" => { :number => 0, :shoe => 16, :points => 22, :rebounds => 12, :assists => 12, :steals => 3, :blocks => 1, :slam_dunks => 1 }...
true
15f5f95d3898a2c515ce7c145f3f002dc8f637a1
Ruby
ministryofjustice/Claim-for-Crown-Court-Defence
/lib/extensions/nested_attributes_extension.rb
UTF-8
271
2.53125
3
[ "MIT" ]
permissive
module NestedAttributesExtension def self.included(base) base.extend(ClassMethods) end module ClassMethods def all_blank_or_zero ->(attributes) { attributes.all? { |key, value| key == '_destroy' || (value.blank? || value.zero?) } } end end end
true
fa984e8c308854e2d0b52d91c4ca4bd7ef2549e1
Ruby
djwaldkirch/crucial_clone
/app/models/user.rb
UTF-8
1,413
2.5625
3
[]
no_license
class User < ApplicationRecord #this is the method that pairs with belongs_to in the submission model. it allows one user to be associated with multiple submissions has_many :submissions, dependent: :destroy #downcase email before saving #before_save is a special method used by ActiveRecord bef...
true
eacdd560a6574f7e0ebe5037b5b96930b52cbc44
Ruby
hgodinot/hgodinot-Launch_School
/code_wars/Ruby/4_kyu/7_greatest_warrior.rb
UTF-8
2,603
3.859375
4
[]
no_license
class Warrior VALID_LEVELS = (1..100) RANKS = ["Pushover", "Novice", "Fighter", "Warrior", "Veteran", "Sage"] + ["Elite", "Conqueror", "Champion", "Master", "Greatest"] attr_accessor :level, :experience, :rank, :achievements, :defeated, :valid_fight, :fight_result def initialize ...
true
9f5ecb397289eeb000fd88f481b77e56bbde405f
Ruby
willyspa/the_hacking_gossip_ruby_version_POO
/lib/gossip.rb
UTF-8
440
2.984375
3
[]
no_license
require 'csv' require 'pry' class Gossip attr_reader :author, :content def initialize(author, content) @content = content @author = author end def save CSV.open("db/gossip.csv", "a") do |csv| csv << [@author,@content] end end def self.all all_gossips = [] CSV.fore...
true