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
3f0a39828a0823f1b0c0bcf411a821a82e1c8c00
Ruby
moritzbe/some_revision
/sudoku.rb
UTF-8
1,900
3.546875
4
[]
no_license
require "pry" class Reader def initialize @sudoku end def get_sudoku @sudoku = IO.read("sudoku.txt") end def load @board = Array.new @sudoku.each_line do |line| line.delete! '|+-' line.tr! '_', '0' line.squeeze! line.strip! if line.length > 0 ...
true
c9b75f68c00ed705320f0d92095e972263d7a04a
Ruby
kivanio/brcobranca
/lib/brcobranca/remessa/cnab400/banco_brasilia.rb
UTF-8
8,049
2.515625
3
[ "BSD-3-Clause", "MIT" ]
permissive
# frozen_string_literal: true module Brcobranca module Remessa module Cnab400 class BancoBrasilia < Brcobranca::Remessa::Cnab400::Base attr_accessor :convenio validates_presence_of :agencia, :conta_corrente, :digito_conta, message: 'não pode estar em branco.' validates_length_of :a...
true
85a7561d02b774af49f56652cf3578f67a519ae2
Ruby
jonatas/learning-math
/mandala.rb
UTF-8
404
2.78125
3
[ "MIT" ]
permissive
require "rubygems" require "drawille" canvas = Drawille::Canvas.new degree = 10 #30 size = 1 if ARGV[0] degree = ARGV[0].to_i end frame = canvas.paint do move 10, 100 down n_times = (3.6 * degree).to_i n_times.times do right degree * size n_times.times do forward degree * size right de...
true
53e22194a2e24e5cfdb85ac4214faedf8f34a662
Ruby
Tludi/travelapp
/test/models/user_test.rb
UTF-8
921
2.546875
3
[]
no_license
require 'test_helper' class UserTest < ActiveSupport::TestCase def setup @user = users(:one) end test "user should have a name" do assert_not_nil :username end test "user should have a password" do assert_not_nil :password end test "user name should be Tim" do assert_equal @user.usern...
true
eafb0f51d8fb55b5cc0892ecf659019c133aae4b
Ruby
dawa/codeprep
/hackerrank_counting_groups.rb
UTF-8
2,394
3.71875
4
[]
no_license
# Complete the function below. def countGroups(m, t) @row = m.size - 1 @column = m.first.length - 1 # puts "row:#{@row} column:#{@column}" visited = [] # Make a bool array to mark visited cells. # Initially all cells are unvisited 0.upto(@row) do |i| visited[i] = [] 0.upto(@...
true
a4f3a53c229f77ae2bfb981ddcb41b096a6381ad
Ruby
Jenietoc/Ruby_kommit_course
/Hashes II/The_Select_and_reject_Methods_on_a_hash.rb
UTF-8
173
2.703125
3
[]
no_license
recipe = { sugar: 5, flour: 10, salt: 2, pepper: 4 } p recipe.select { |ingredient, teaspoons| teaspoons >= 5 } p recipe.reject { |ingredient, teaspoons| teaspoons >= 5 }
true
d74a06b6ef37418074383828e80848e53cdeb8b6
Ruby
raielin/wdi_1_ruby_hw_mbta_simplified
/mbta.rb
UTF-8
5,168
4.0625
4
[]
no_license
# ---------------- wdi_1_ruby_hw_mbta_simplified ---------------- =begin Red Line Alewife Davis Porter Harvard Central Kendall/MIT Park Street South Station Green Line Haymarket Government Center Park Street Boylston Arlington Copley Orange Line North Station Haymarket Park Street ...
true
1e12a6ec092b6aa8c21264d3d3e2245b84e4aa07
Ruby
djmaze/arid_cache
/lib/arid_cache/cache_proxy.rb
UTF-8
13,696
2.765625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module AridCache class CacheProxy attr_accessor :object, :key, :opts, :blueprint, :cached, :cache_key, :block, :records, :combined_options, :klass # AridCache::CacheProxy::Result # # This struct is stored in the cache and stores information we need # to re-query for results. Result = Struct.n...
true
fc3c211e3f2354874fad751e80fe11586c4ca71f
Ruby
amadden80/lemurick
/lib/lemurick/lemurs/yaniv.rb
UTF-8
482
3.09375
3
[ "MIT" ]
permissive
module Lemurick class Yaniv def speak quotes.sample end def quotes [ 'Have you tried binding.pry yet?', 'Heugh?', 'Good morning, lemurs!', 'Handlebars, guys. Handlebars!', 'Questions? Thoughts? Comments?', 'Sweet, double digits! (inside joke wi...
true
f1aa8146dc530c082a95beb159d772ff6cc508c5
Ruby
stanams/drivy-test
/level6/main.rb
UTF-8
1,215
3.03125
3
[]
no_license
require "json" require "date" require_relative "models/rental" require_relative "models/car" require_relative "models/rental_modification" class Drivy attr_reader :data def initialize(data) @data = JSON.parse(data) @cars = @data["cars"].map do |car| Car.new( car["id"], car["price_per...
true
c27a2299951d098aa7ffb335c207114993c70a13
Ruby
SebastianBabb/RubyHTTPServer
/Logger.rb
UTF-8
809
2.671875
3
[]
no_license
#!/usr/bin/ruby class Logger def initialize(filepath) @filepath = filepath end def write(request, response) # Open log file for writting. @file = File.open(@filepath, "a") # Build the log string. log_entry = IPSocket.getaddress("localhost") # log_en...
true
23a3bf54a14aa5815207e5d9723b5d8b80a77a87
Ruby
lkingson2/angelbot
/bots/lunch-bot.rb
UTF-8
2,822
3.125
3
[]
no_license
require 'slackbot_frd' require 'securerandom' require_relative '../lib/lunch/search' class LunchBot < SlackbotFrd::Bot def contains_trigger(message) message =~ /(!lunch)/i end def does_not_contain(message) !(message =~ /(template)/i && message =~ /(example)/i) end def send_invalid_command_error(s...
true
82f70acb1ffe210113099b9cf588624be18eaa22
Ruby
NotTheUsual/Sudoku-TDD
/lib/grid.rb
UTF-8
2,466
3.375
3
[]
no_license
class Grid attr_reader :cells ROWS = (0..80).each_slice(9).to_a COLUMNS = ROWS.transpose SQUARES = [[0,1,2,9,10,11,18,19,20],[3,4,5,12,13,14,21,22,23],[6,7,8,15,16,17,24,25,26],[27,28,29,36,37,38,45,46,47],[30,31,32,39,40,41,48,49,50],[33,34,35,42,43,44,51,52,53],[54,55,56,63,64,65,72,73,74],[57,58,59,66,67,68,...
true
4e9fec26737a4ba88f821de54b813fbd0b70cb05
Ruby
gabriel-wilkes/Launch-School-Exercises
/100/Intro-to-Programming/8-Files/2.rb
UTF-8
232
2.640625
3
[]
no_license
d = Dir.new(".") while file = d.read do puts "#{file} has extension .txt" if File.extname(file) == ".txt" end require 'pathname' pn = Pathname.new(".") pn.entries.each { |f| puts "#{f} has extension .txt" if f.extname == ".txt" }
true
4bc217c6d14f53190b9c2743cc37cd154240f801
Ruby
tfutada/RubyTutorial
/10Lambda.rb
UTF-8
243
3.578125
4
[]
no_license
def sum(x, y) return x + y end p sum(1, 2) def ajax(callback, v) return callback.(v) end p ajax(-> x {x* 2}, 3) # Lambda is a first object #p ajax({|x| x * 2}, 3) # Error ! p ajax(Proc.new{|x| x * 2}, 3) # make a bloc a object
true
bd7470211d2e547f75da785b804543c825f1118f
Ruby
IChurnCode/war
/side.rb
UTF-8
200
3.28125
3
[]
no_license
class Side attr_accessor :height attr_reader :name def initialize(name, height) @name = name @height = height end def withStoodAttack(strength) height >= strength end end
true
b52995a7a5fa4192deed3d850d7fae8f7339dd01
Ruby
kjamrozy/bouncy-madness
/src/objects/projectiles/projectile.rb
UTF-8
570
2.890625
3
[]
no_license
require_relative '../../helpers/object_helper' require_relative '../base_object' # Projectile - dziedziczy po BaseObject. Posiada bazową prędkość i cooldown. Znika po dotarciu do górnej krawędzi ekranu. class Projectile < BaseObject include ObjectHelper def initialize(scene, params = {}) super(scene, params) ...
true
04bab36a7d14e6aff98c76c7eff201f2e3915cec
Ruby
shadoath/Euler
/05/test_spec.rb
UTF-8
305
2.84375
3
[]
no_license
require_relative "./problem.rb" RSpec.describe Number5 do it "gets example to validate" do n = Number5.new(2510, (1..10)) expect(n.smallest_number).to be 2520 end it "gets example to validate" do n = Number5.new(2510, (1..20)) expect(n.smallest_number).to be > 232792560 end end
true
e1fa2d19ece117a7781ec121064651a4baa3d355
Ruby
rzchen/codewars30days
/hw_total.rb
UTF-8
38,729
3.984375
4
[]
no_license
# ================================================================= # 4-1. 完成以下產生訂單編號程式之實作內容: def generate_odd_numbers(n) (1..n).select { |num| num.odd? } end p generate_odd_numbers(7) # 印出 [1, 3, 5, 7] p generate_odd_numbers(15) # 印出 [1, 3, 5, 7, 9, 11, 13, 15] p generate_odd_numbers(8) # 印出 [1, 3, 5, 7] p ge...
true
58d44dcba5b7a2abf4c30416e140a002f082ec35
Ruby
rickbmitchell/memr-app
/app/models/archive.rb
UTF-8
614
2.71875
3
[]
no_license
class Archive < ActiveRecord::Base belongs_to :post def self.sort_winners # 1.week.ago.beginning_of_week..1.week.ago.end_of_week weekly_sort = Post.where(:created_at => (1.week.ago..Time.now)) winner_sort = weekly_sort.sort_by { |post| post.votes.count }.reverse end def self.archive_winner or...
true
802de78e03fc91657bf6331998f71b645245101b
Ruby
ryanoglesby08/BootCamp
/Parking Lot/parking_lot.rb
UTF-8
980
3.421875
3
[]
no_license
require 'space' require 'observer' class ParkingLot include Observable def initialize(size) @spaces = [] size.times do |index| @spaces[index] = Space.new end @available_spaces = @spaces.size end def park_car(car) raise "This lot is full!" if is_full? @spaces.each do |space| ...
true
909b9d22d65750d13e362153fc32703d6e909cdf
Ruby
sleepynate/saas-class
/lesson2/lesson2-part2.rb
UTF-8
523
3.296875
3
[]
no_license
require "test/unit" class CartesianProduct include Enumerable def initialize (a, b) @member_a = a @member_b = b end def each @member_a.each do |a| @member_b.each do |b| yield [a,b] end end nil end end class TestCartesian < Test::Unit::TestCase def test_two c = ...
true
dd9e26b2142231e1bb69a1add225cc62efc93783
Ruby
ryanchpowell/csci324-hangman
/guitest.rb
UTF-8
7,177
2.859375
3
[]
no_license
require 'ruby2d' set background: 'white' def pick_random_line random_line = nil File.open("dictionary.txt") do |file| file_lines = file.readlines() random_line = file_lines[Random.rand(0...file_lines.size())] #puts "#{random_line}" #close.File return random_line end end def displayalphabet ...
true
2514c55127f54b1db7a01ae3a712890349133f84
Ruby
SiebertBrandon/Ruby-Playground
/Sets/Quick_Demo.rb
UTF-8
1,991
3.484375
3
[ "MIT" ]
permissive
# Name: Brandon Siebert # Course: CSC 415 # Semester: Fall 2017 # Instructor: Dr. Pulimood # Project name: Assignment 1 # Description: Design a Set class which holds operates on a set of Subscriber objects. # Filename: Quick_Demo.rb # Description: Linear demo showing off the functionality of the classes contained in Su...
true
44118c03408c13de63d2ba305a67ac819b8cba48
Ruby
dvilchez/dvKatas
/study_groups/7L7W/ruby/secret_number.rb
UTF-8
270
3.203125
3
[]
no_license
secret_number=rand(10) guess_number=-1 puts 'give me a name between 0 and 9' guess_number=gets.to_i while guess_number!=secret_number puts 'too low' if guess_number<secret_number puts 'too high' unless guess_number<secret_number guess_number=gets.to_i end puts 'OK'
true
c6a956891e193de2ffbf5fbe031e2aa9a8fdeae1
Ruby
etalab/sirene_as_api
/app/concepts/stock/task/fetch_latest_remote_stock_etablissement.rb
UTF-8
1,466
2.53125
3
[ "MIT" ]
permissive
require 'nokogiri' require 'open-uri' class Stock module Task class FetchLatestRemoteStockEtablissement < Trailblazer::Operation step :fetch_latest_link step :build_stock_from_link def fetch_latest_link(ctx, logger:, **) ctx[:stock_link] = geo_sirene_url rescue OpenURI::HTTPError...
true
01b0f7bf5679fc98bc829d5abc3ec9e8dde81865
Ruby
ajalexander/sinatra-bootstrap-starter
/models/user.rb
UTF-8
653
2.65625
3
[ "MIT" ]
permissive
require 'bcrypt' class User < Sequel::Model set_primary_key [:id] plugin :validation_helpers def validate super validates_presence [:username, :email_address, :password_hash] validates_unique :username end def password=(new_password) if new_password.nil? || new_password.empty? self.p...
true
85047304c9c4eebff539eba98d10016c569f9ab3
Ruby
millarba/wknd_4
/oop/calc_3.rb
UTF-8
4,361
4.40625
4
[]
no_license
# In this example, we have THREE calculators, the two included in the previous # exercises as well as Whiz Bang Calculator that can even calculate the hypotenuse # of a triangle if given the length of the other two sides. Figure out how to # DRY up all the code below - there shouldn't be a single method duplicated bet...
true
3ccd248df2e00c00324a1d4cd9dd1df4dc61a780
Ruby
goshan/werewolf
/app/games/entities/player.rb
UTF-8
2,600
2.53125
3
[ "MIT" ]
permissive
class Player < CacheRecord attr_accessor :pos, :user_id, :role, :status, :name, :image def self.key_attr 'pos' end def self.find_by_user(user) self.find_all.select { |p| p.user_id == user.id }.first end def self.find_by_role(role) self.find_all.select { |p| p.role && p.role.name == role }.fir...
true
fa08fc9a7dc3247857fd0cede16bf67ea0b87dd5
Ruby
saranderson13/ruby-objects-has-many-through-lab-online-web-pt-041519
/lib/appointment.rb
UTF-8
340
3
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Appointment attr_accessor :date, :patient, :doctor @@all_appointments = [] def self.all @@all_appointments end def initialize(date, patient, doctor) @date, @patient, @doctor = date, patient, doctor self.class.all << self doctor.appointments << self patient.appointment...
true
b4a0e822791a6c4b9ef23afdf03bf1a22694b552
Ruby
jtynerbryan/ruby-objects-has-many-through-lab-web-062617
/lib/song.rb
UTF-8
201
3.234375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'genre.rb' require 'artist.rb' class Song attr_accessor :genre, :artist def initialize(name, genre) @name = name @genre = genre genre.songs << self end def genre @genre end end
true
08b257c19b5be584861ba62001a743630b2e3e5b
Ruby
abrahamodukoya/cs3012-software-eng
/github-access/data-vis/github-api/github-api-access.rb
UTF-8
1,199
2.671875
3
[]
no_license
require 'uri' require 'json' require 'net/http' require 'io/console' #removed authentication; don't need it for public repositories def send_request(uri, params, user, password) request = Net::HTTP::Get.new(uri) request.basic_auth(user, password) req_options = { use_ssl: uri.scheme == "https", } params.e...
true
0c3caac40ce604840412fe49454ce0a776d9492a
Ruby
BadgerGroup/BadgerAPI
/badgerAPI.rb
UTF-8
3,095
2.6875
3
[]
no_license
require 'sinatra' require './SQLHelper' require 'json' # Entry point for Badger RESTful API. When executed, this file starts a web application # that listens for requests on the following endpoints. db = SQLHelper.new FileUtils.cp("public/index.html", "README.md") # update the homepage with the README documentation ...
true
011f06229689a92b3f8ddcbf5d0cad3a1df133b2
Ruby
jaxdid/rps-challenge
/lib/AI.rb
UTF-8
211
3
3
[]
no_license
class AI attr_reader :weapon_choice def initialize weapon_list = ['rock', 'paper', 'scissors'] random_index = Kernel.rand(weapon_list.length) @weapon_choice = weapon_list[random_index] end end
true
ba5640b6352a126095f6415cf1b17a75855eb363
Ruby
runkmc/exercises
/17/ruby_17.rb
UTF-8
751
4.09375
4
[]
no_license
class BAC def initialize(oz, weight, gender, hours) @oz = oz @weight = weight @gender = self.gender_number gender.strip @hours = hours end def bac_number (@oz * (5.14 / @weight) * @gender) - (0.015 * @hours) end def legal? bac_number >= 0.08 ? false : true end def gender_numbe...
true
d871af9d9186eecca6df9eb4b9edeb91c17a921b
Ruby
laurkim/ruby-objects-has-many-through-lab-web-091817
/lib/song.rb
UTF-8
554
3.234375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_accessor :name, :artist, :genre def initialize(name, genre) @name = name @genre = genre genre.songs << self # genre.add_song(self) end end # rap = Genre.new("Rap") # hotline_bling = Song.new("Hotline Bling", rap) # hotline_bling.genre => rap # rap.add_song(hotline_bling) # rap...
true
2b3227c4d2016d1e7aafbb9d7ac74777602ea7b4
Ruby
wkdewey/regex-lab-online-web-sp-000
/lib/regex_lab.rb
UTF-8
649
3.25
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def starts_with_a_vowel?(word) if word.match(/\b[aeiouAEIOU]\w+/) return true else return false end end def words_starting_with_un_and_ending_with_ing(text) words = text.split return words.grep(/un\w+ing/) end def words_five_letters_long(text) words = text.split return word...
true
4cd780a98e2b509279d6061aa82f23b25daca5d5
Ruby
Thristhart/fluxx-base
/test/helper.rb
UTF-8
2,937
2.5625
3
[]
no_license
require 'simplecov' SimpleCov.start require 'minitest/spec' require 'minitest/autorun' require 'fluxx/card' require 'fluxx/library' # Remove any cards the library itself loads, only use the ones we define below, # for testing purposes. Fluxx::Library.clear! # Pretty basic keepers, that has a category. NB: These nee...
true
f99ce70b9a1c7e49027bf6eeba1538b922fdc860
Ruby
Tmgree/takeaway-challenge
/lib/order.rb
UTF-8
541
3.40625
3
[]
no_license
require_relative 'menu' class Order attr_reader :current_order, :current_total def initialize @current_order=[] @current_total=0 end def add_dish(menu, dish, quantity) if menu.dish_list.include?(dish) add_money(menu, dish, quantity) current_order << {dish => quantity} "You have ordere...
true
6ff71a379c3616a7335f9b592897674acac1a10a
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/house/ece23e54dd6e4fcdb3e707fe4625cd10.rb
UTF-8
1,511
3.25
3
[]
no_license
class House WORDS = { 1 => { :name =>"house",:desc => "that Jack built.", :action => "lay in" }, 2 => { :name =>"malt", :action => "ate" }, 3 => { :name =>"rat", :action => "killed" }, 4 => { :name =>"cat", :action => "worried" }, 5 => { :name =>"dog", :action => "tossed" }, 6 => { :name =>"c...
true
0b74a76e54f678f97e024895b060a14e9257c53f
Ruby
woahdae/simple_xlsx_reader
/lib/simple_xlsx_reader/loader/shared_strings_parser.rb
UTF-8
1,148
2.671875
3
[ "MIT" ]
permissive
# frozen_string_literal: true module SimpleXlsxReader class Loader # For performance reasons, excel uses an optional SpreadsheetML feature # that puts all strings in a separate xml file, and then references # them by their index in that file. # # http://msdn.microsoft.com/en-us/library/office/gg2...
true
95664e786f966b441ae8968ebe7cabebb9be0d47
Ruby
brianwang/gftop
/learning/railsLearning/BuildYourOwnRubyOnRailsWebApplications/chapter03/07_Inherit.rb
UTF-8
312
3.359375
3
[]
no_license
# 3.4.4 继承 class Car @@wheels = 4 def initialize puts "该对象的默认车轮数为#{@@wheels}" end end class StrechLimo < Car # StrechLimo继承自Car @@wheels = 6 def turn_on_television puts '打开电视' end end larry = StrechLimo.new larry.turn_on_television
true
44beaeadcfa11781b106cde45fdaf8c9ac9917fb
Ruby
insignia4u/i4u
/lib/populator/projects.rb
UTF-8
1,566
2.65625
3
[]
no_license
require "populator/images" module Populator class Projects def initialize Project.delete_all @images = Populator::Images.new end def create!(q=1) q.times do project = create_project project.technologies << [technologies.sample] project.tools << [tools.sa...
true
008c2fb9ed46719ded296656dbe40570dcadc2e7
Ruby
ajsaule/Warmups
/week-7/starbucks.rb
UTF-8
348
3.484375
3
[]
no_license
require 'pry' class Coffee def initialize name, order, size, sugar name[0] = "B" @name = name @order = order @size = size @sugar = sugar end def to_s "#{@name}'s #{@order}, #{@size}, #{@sugar}" end end donny = Coffee.new "Donny", "Long Black", "Large"...
true
67e17e9bb0f56de096f6f6e99bc26d19ba546757
Ruby
saks/ooffice
/lib/ooffice/marker.rb
UTF-8
665
3.140625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module OOffice class Marker # Will be raised if document object already has accessor with name wich # equals to marker name class ForbiddenMarkerName < Exception; end attr_reader :text_node, :replace_range def initialize(text_node, marker_string) @text_node = text_node @marker_string = marker_st...
true
72980e1cc26010d73f15d2ba47f5f3f82d01c4b2
Ruby
macooma/RubyCodes
/RubyLearning/lib/profile_sample.rb
UTF-8
367
2.875
3
[]
no_license
require 'profile' count = 0 words = File.open("rangetest") while word = words.gets word = word.chomp! if word.length >= 10 count += 1 end end puts "#{count} more-than-10-character words" #require 'profile' #words = File.read("rangetest") #count = words.scan(PATT = /^..........(.*)\n/).size #puts "#{count} m...
true
b3ae9870584b1575e6ea12d8df9266982b672dba
Ruby
karthickrajaKa/wiz
/lib/daybook.rb
UTF-8
1,016
2.96875
3
[ "Apache-2.0" ]
permissive
# Understanding the framework with the module Daybook def self.has_command?(command) response = `which #{ command }` response != "" end def self.interpret(command) responses = [] # Here xox is a shell script to open representation for my timesheet. if command.match(/^xox/i) || comman...
true
543142c96c0343e0ad65469e11e51c5bba9d90cc
Ruby
b-enji-cmd/flash_cards
/test/round_test.rb
UTF-8
2,371
3.640625
4
[]
no_license
require 'minitest/autorun' require './lib/card' require './lib/turn' require './lib/deck' require './lib/round' require 'pry' class RoundTest < Minitest::Test def setup @card_1 = Card.new("What is the capital of Alaska?", "Juneau", :Geography) @card_2 = Card.new("The Viking spacecraft sent back t...
true
1c17cc08b871674b3bfbea13830fd34565074f5a
Ruby
jalkoby/recast
/lib/recast/model.rb
UTF-8
335
2.5625
3
[ "MIT" ]
permissive
module Recast::Model def become(roles, *args, &block) role = Array(roles).map(&:to_s).join('/') begin klass = self.class.class_eval(Recast::Utils.camelize(role)) rescue NameError raise Recast::Errors::RoleNotFound, "Undefined role #{ role } for #{ self }" end klass.new(self, *args, &bl...
true
2fa0678bb5c7f94e5048e84e662d1d5abb96ee0a
Ruby
softprops/list_fu
/lib/list_fu.rb
UTF-8
3,820
2.6875
3
[ "MIT" ]
permissive
module Soft module Props module ListFu module Helpers return if ActionView::Base.included_modules.include? Soft::Props::ListFu::Helpers # Renders an html list of records. # args can be one or two hashes of options, # the first for the top-level list element and ...
true
921f60d4738522adb2cfe86f420b5f7bc665b0a6
Ruby
rgo/adventofcode-2020
/03-toboggan-trajectory/main_exercise_1.rb
UTF-8
369
3.078125
3
[]
no_license
#!/usr/bin/env ruby # frozen_string_literal: true require './map' require './toboggan' map = Map.new 'map_input.txt' toboggan = Toboggan.new while toboggan.location[:y] < map.y_size - 1 toboggan.slide toboggan.location[:x] %= map.x_size toboggan.hit_tree if map.tree?(x: toboggan.location[:x], y: toboggan.loc...
true
acaf78087746f0708360fa2644cdd9f9c1df6a00
Ruby
danachen/Ruby
/LS101/easy7/p5.rb
UTF-8
724
4.375
4
[]
no_license
# Prob 5: Staggered Caps (Part 1) # Go through the input, treat each space as a character # Each other character gets capitalized or not # Can lowercase everything, then upcase when index is odd # Then join them together again def staggered_case(input) input = input.downcase new_arr = [] input.chars.each_wi...
true
8e0d4f317b90c3527d00dd6734f160b5897fa874
Ruby
iRonnie16/RubyProjects
/Casual/Histogram.rb
UTF-8
290
3.5625
4
[]
no_license
#!/usr/bin/env ruby puts "Text to sort" text = gets.chomp words = text.split(" ") frequencies = Hash.new(0) words.each {|word| frequencies[word] += 1} frequencies = frequencies.sort_by {|word, count| count} frequencies.reverse! frequencies.each {|word, count| puts word + " " + count.to_s}
true
e868b570fefa5b7dcb1f94c2b0cb5e47ea790bd2
Ruby
kiosself/viselitsa
/result_printer.rb
UTF-8
2,807
3.5625
4
[]
no_license
# Класс, печатающий состояние и результаты игры class ResultPrinter def initialize # создадим поле класса, массив, хранящий изображения виселиц @status_image = [] current_path = File.dirname(__FILE__) counter = 0 # счетчик шагов while counter <=7 do # в цикле прочитаем 7 файлов и запишем из со...
true
e14e76669760f51bcf4d506339ad4b6a4278fc09
Ruby
mollycooper64/ttt-5-move-rb-bootcamp-prep-000
/bin/move
UTF-8
1,236
4.375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#!/usr/bin/env ruby require_relative '../lib/move.rb' #1. Our program should first welcome the player by outputting a friendly message to the terminal: "Welcome to Tic Tac Toe!". puts "Welcome to Tic Tac Toe!" #2. Next, establish the starting state of the game, i.e. the empty board. Create a new board by setting a va...
true
7eff14b00229af5c976394f1e038a1f6c90d7078
Ruby
lucasjct/Ruby-Brief-Introdution
/POO/exemplos/lampada.rb
UTF-8
420
3.609375
4
[]
no_license
class Lampada def opcao puts "Digite [on] para ligar ou [off] desligar." ligar = gets case ligar when "on" puts "Lâmpada acessa" when "off" puts "Lâmpada apagada" else puts "Opção Inválida" end end end class Lampar...
true
a78f8b92c483552a146cdc8b9842bec22950d63e
Ruby
Superbuddha/Gym-Ruby-project
/db/seeds.rb
UTF-8
2,488
2.8125
3
[]
no_license
require_relative( "../models/gymclass.rb" ) require_relative( "../models/member.rb" ) require_relative( "../models/booking.rb" ) require("pry-byebug") Booking.delete_all() Gymclass.delete_all() Member.delete_all() gymclass1 = Gymclass.new({ "name" => "Monday 5pm", "activity" => "Boxing" }) gymclass1.save() gymc...
true
8dc1b6b2f76cf99f13a31885e93712cf1d99dd2c
Ruby
TimBek2/phase-0
/week-4/contents.rb
UTF-8
309
2.921875
3
[ "MIT" ]
permissive
line_width = 60 puts( "Table of Contents".center(line_width)) puts( "Chapter 1: Getting Started".ljust(line_width/2) + "page 1".rjust(line_width/2)) puts( "Chapter 2: Numbers".ljust(line_width/2) + "page 9".rjust(line_width/2)) puts( "Chapter 3: Letters".ljust(line_width/2) + "page 13".rjust(line_width/2))
true
e167d2f83f3cb8c89689ec2e942d70dd6cfcff26
Ruby
urimikhli/view_records
/data_record_list.rb
UTF-8
828
3.296875
3
[]
no_license
class DataRecordList attr_accessor :record_list def initialize @record_list = Array.new end def output_records(sort_by = "") if sort_by.eql? "gender" sort_by_gender_lastname elsif sort_by.eql? "birthdate" sort_by_birthdate_lastname elsif sort_by.eql? "lastname" sort_by_lastnam...
true
2c025443c9b9ab24a812405aabb574397e2c714d
Ruby
Aramir10/rubystuff
/hashes.rb
UTF-8
98
2.90625
3
[]
no_license
states = { "Pennsylvania"=>"PA", "New York"=>"NY", "Texas"=>"TX" } puts states["Texas"]
true
46e707cf0c5356021f7cc91f91ad2f6f63872258
Ruby
iluv2sled/SaaS-Class
/HW1_part5.rb
UTF-8
737
3.546875
4
[]
no_license
class Class def attr_accessor_with_history(attr_name) attr_name = attr_name.to_s # make sure it's a string attr_reader attr_name # create the attribute's getter attr_reader attr_name+"_history" # create bar_history getter class_eval %Q{ def #{attr_name}= (attr_name) if !@#{attr_name}_his...
true
4b73937c3bb670aeb45d7893892521ff1b949017
Ruby
michael-danello/RB101
/lesson_6/twenty_one_cards.rb
UTF-8
3,337
3.21875
3
[]
no_license
# creds to ejm98 for the inspiration for the cards https://www.asciiart.eu/miscellaneous/playing-cards CARD_WIDTH = 7 CARD_HEIGHT = 7 SYM_MAP = { 0 => "", 1 => " * ", 2 => "* *", 3 => "***", 4 => "** **" } SUITS = { :hearts => "v", :diamonds => "*", :clubs => "%", :spades => "o", "K" => 'K', "Q" => 'Q', ...
true
f2d48b21cf5a5069d0cf2c0a45e5b46098fe7c10
Ruby
nkiruka/hotel
/lib/date_range.rb
UTF-8
1,660
3.609375
4
[]
no_license
require 'date' module Hotel class DateRange attr_reader :checkin_date, :checkout_date # Checkin and checkout dates are instances of the Date class def initialize(checkin_date, checkout_date) if !checkin_date.is_a?(Date) || !checkout_date.is_a?(Date) raise ArgumentError.new("Checkin or Chec...
true
8170905ad7049668558a5116f861c90e13453536
Ruby
ccabot/popHealth
/lib/match_helper.rb
UTF-8
3,556
2.625
3
[ "Apache-2.0" ]
permissive
# Module to be included into models who do matching against clinical documents # The match value function will pull the section and subsection names from # the methods section_name and subsection_name. By default, section_name # will return the underscore name of the class. Subsection will return nil. # To cha...
true
9ca9669efe937c3eead1712fa1c5e3f30f01407d
Ruby
dlamacchia/pyramid
/lib/pyramid/resources/likes_summary.rb
UTF-8
253
2.546875
3
[ "Apache-2.0" ]
permissive
module Pyramid class LikesSummary attr_reader :count, :liker_ids def initialize(count, liker_ids) @count = count @liker_ids = liker_ids end def to_json {count: count, liker_ids: liker_ids}.to_json end end end
true
358a6907d7c4e8965bb4a79dcdcde8c68d3ea49d
Ruby
CatonNip/phase-0-tracks
/ruby/list/todo_list.rb
UTF-8
263
3.53125
4
[]
no_license
class TodoList def initialize(list) @list = ["do the dishes", "mow the lawn"] end def get_items @list end def add_item(string) @list << string end def delete_item(string) @list.delete(string) end def get_index(index) @list[index] end end
true
0e8d55754c71d968186ef7fcde5ac300212990aa
Ruby
jcmuller/msewage-importer
/lib/msewage-importer/source_types.rb
UTF-8
1,585
2.78125
3
[ "MIT" ]
permissive
module Msewage::Importer class SourceTypes class << self def given_type_to_apis(type) source_types[internal_types_to_msewages[type]] end def types_supported %w{ animal_manure combined_sewer_outflow industrial_waste_outflow latrine ...
true
5dae65a5af1f826280a7bfad9a7b7cb65614b7b2
Ruby
jpe442/W2D1project
/chess/piece.rb
UTF-8
286
2.890625
3
[]
no_license
require_relative "board" class Piece attr_reader :color def initialize(name, color) @name = name @color = color end def to_s() @name end def symbol() end def valid_moves() end def move_into_check(to_pos) end def valid_move? true end end
true
61f08f235922bd98e7749f5c72076d06b71a1194
Ruby
wainhudec88/semantic-attributes
/lib/predicates/unique.rb
UTF-8
1,759
2.78125
3
[]
no_license
# Describes an attribute as being unique, possibly within a certain scope. # # ==Options # * :scope [array] - a list of other fields that define the context for uniqueness. it's like defining a multi-column uniqueness constraint. # * :case_sensitive [boolean, default false] - whether case matters for uniqueness. # # ==...
true
7185c40701db5f178086ebccddfaf65624198965
Ruby
lucas54neves/my-beecrowd-solutions
/ruby/URI_1010.rb
UTF-8
270
2.984375
3
[ "MIT" ]
permissive
produto1 = gets.split produto2 = gets.split cod1 = produto1[0].to_i qtd1 = produto1[1].to_i valor1 = produto1[2].to_f cod2 = produto2[0].to_i qtd2 = produto2[1].to_i valor2 = produto2[2].to_f total = qtd1 * valor1 + qtd2 * valor2 puts "VALOR A PAGAR: R$ %.2f" % total
true
44f346be5f73bb72ae10741b68ebb32c1ca36a61
Ruby
martinliptak/sampleapp
/app/objects/ability.rb
UTF-8
988
2.515625
3
[ "MIT" ]
permissive
class Ability include CanCan::Ability def initialize(user) if user send(user.role, user) else unauthenticated(user) end end private def unauthenticated(user) # can sign up can :create, User end def regular(user) # can access dashboard and create meals ...
true
52de33ad12d149a510d3e46b8d3cd18d37c5a345
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/anagram/2f83b9b2909f49ca882e5867441722b6.rb
UTF-8
249
3.390625
3
[]
no_license
class Anagram < String def match strings strings.select do |string| next if string.downcase == self.downcase sort(string) == sort(self) end end private def sort string string.downcase.chars.sort.join end end
true
191e7546405d5f62d33e116a0991ac69c7bff8d6
Ruby
senohirona/practice-ruby
/chapter-4/direct.rb
UTF-8
193
3.5
4
[]
no_license
# 変数を使わずにメソッドを呼び出す drinks = ["コーヒー", "カフェラテ"] p drinks.first #=> コーヒー p ["コーヒー", "カフェラテ"].first # => "コーヒー"
true
4ddd272424c9ac372f3e9e043999a80ca74c9db8
Ruby
paulotijero/caesar-cipher
/cipher.rb
UTF-8
577
3.578125
4
[]
no_license
def cipher(message, factor) message.bytes.map do |byte| if [*65..90].include?(byte) byte + (factor%26) > 90 ? (byte + (factor%26) - 26).chr : (byte + (factor%26)).chr elsif [*97..122].include?(byte) byte + (factor%26) > 122 ? (byte + (factor%26) - 26).chr : (byte + (factor%26)).chr else ...
true
14041c3818b96c25a949fa47d655efaecfaa1dce
Ruby
mfenner/mfenner.github.io
/_plugins/jekyll_orcid.rb
UTF-8
1,253
2.59375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'faraday' require 'faraday_middleware' module Jekyll FORMATS = ["bib","json","yml"] class BibliographyFile < StaticFile def initialize(site, base, dir, name) @site = site @base = base @dir = dir @name = name if site.config['author']['orcid'] url = "http://feed.l...
true
97ec22d1edff87833b843744e7fc1f46c7c46ac5
Ruby
nexusventuri/projecteuler
/27/lib/problem27.rb
UTF-8
545
2.921875
3
[]
no_license
$:.unshift File.expand_path("../../../common/lib/", __FILE__) require 'integer_utils.rb' class Problem27 def count_prime(a, b) n = 0 partial = (n**2 + a*n + b) while partial > 0 && partial.prime? n += 1 partial = (n**2 + a*n + b) end n end def find_best_quadratics_product a, ...
true
231aded170fef97c62bb8358ab7a72db00762489
Ruby
jkoppel/project-ironfist
/tools/Revitalize/seance/src/dir/ops.rb
UTF-8
522
3.140625
3
[]
no_license
module DirOps def self.ensure_dir(path) Dir.mkdir(path) unless File.exists?(path) end class << self def subdir(root, folder) "#{root}/#{folder}" end alias file_in subdir def nested_subdir(*dirs) dirs.inject("") {|path, d| subdir(path,d) } end def imprope...
true
d2351d997b0781099ac061a5bff89820a09f227c
Ruby
YosefSchoen/Compiler-Mini-Project
/Compiler/ParserXML.rb
UTF-8
17,754
3.296875
3
[]
no_license
require_relative 'CompilerUtility' require_relative 'Tokenizer' #the first function called compiles the file's class def compileClass(tokens, classNames) i = 0 str = "" #terminal class if notToLarge(tokens, i) and isCorrectToken(tokens, i, "class") str+= "<class>"+"\n"+getXMLString(tokens, i) i+=1 ...
true
b0d84db6369633087351be611018559f3e0280bc
Ruby
izzyjohnston/algo2
/algo2/lib/graph1.rb
UTF-8
1,719
3.453125
3
[]
no_license
class Containers::MinHeap def [](key) @stored[key] end end class Graph1 attr_accessor :vertices def initialize(filename) self.vertices = {} IO.foreach(filename) do |edge| start, stop, cost = edge.split(' ') #add both ways since non-directed (self.vertices[start] ||= []) << [stop, ...
true
19266bd48137e4ec63f1572f1a37233c66565566
Ruby
theozaurus/i18n
/lib/i18n/backend/active_record.rb
UTF-8
1,258
2.515625
3
[ "MIT" ]
permissive
require 'i18n/backend/base' require 'i18n/backend/active_record/translation' require 'i18n/hash' module I18n module Backend class ActiveRecord < Base def reload! end def store_translations(locale, data) data.unwind.each{|key,v| Translation.create(:locale => locale.to_s...
true
9388f61f16bf0fbeada18f8bcc5077ef990b8df5
Ruby
Cireou/programming-univbasics-nds-green-grocer-part-2-yale-web-yss-052520
/lib/grocer_part_2.rb
UTF-8
917
3.25
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative './part_1_solution.rb' require "pry" def apply_coupons(cart, coupons) coupons.each do |coupon| item_info = find_item_by_name_in_collection(coupon[:item], cart) next if (not item_info) || coupon[:num] > item_info[:count] item_info[:count] -= coupon[:num] new_item = { item:...
true
5c8e9c58aba8f6121604bafd8a07ddc2756027ef
Ruby
devitagus/fullstack-challenges
/02-OOP/01-OO-Basics/01-Define-your-own-class/lib/motorcycle.rb
UTF-8
444
3.34375
3
[]
no_license
class Motorcycle attr_reader :brand, :model, :name def initialize(name, brand, model, color, ccs) @name = name @brand = brand @model = model @color = color @ccs = ccs end end bonneville = Motorcycle.new("Bonneville", "Triumph", "Scramber", "Blue", 890) v7 = Motorcycle.new("V7", "Guzzi", "Spe...
true
f303a0a739c99816dd4536483f2670e830acce16
Ruby
koustubh89/Calculator
/spec/calculator_spec.rb
UTF-8
1,944
3.34375
3
[ "MIT" ]
permissive
require 'spec_helper' describe 'Calculator' do context "Core functionality" do context 'add' do it "add 5 to stored value viz 3 to give 8" do calculator = Calculator.new(3) expect(calculator + 5).to eq(8) end it "add 4 to stored value viz 9 to give 13" do calculator = ...
true
aac0c75d5d94fb405f5bc58a12ad7c3b819d8345
Ruby
stellanorthm/sep-assignments
/01-data-structures/05-hashes-part-2/open_addressing/open_addressing.rb
UTF-8
1,833
3.546875
4
[]
no_license
require_relative 'node' class OpenAddressing def initialize(size) @items = Array.new(size) @size = size end def []=(key, value) i = index(key, @size) hashed_i = @items[i] if hashed_i.nil? @items[i] = Node.new(key, value) elsif hashed_i.key != key while @items[index(key, @size...
true
c75a11c0cbb9271b1266fe8cbc2a7c19170a8545
Ruby
grcdeepak1/project_cli_connect_four
/connect_four/lib/disk.rb
UTF-8
432
3.21875
3
[]
no_license
# public methods: marker, marker=, ==, to_s # private methods : - # test #initialize with default, x, 0 # test #== with other disk with same marker # test #== with different marker disk # test #to_s returns a string class Disk attr_accessor :marker def initialize(marker = nil) @marker = marker end def ==(o...
true
7b55258c4b482fb2eb90d55649ded280a4783b7c
Ruby
cfitz/beacon
/spec/helpers/documents_helper_spec.rb
UTF-8
2,441
2.59375
3
[]
no_license
# using this for now until we get more accecptance tests from people... require 'spec_helper' describe DocumentsHelper do it "should be included in the object returned by #helper" do included_modules = (class << helper; self; end).send :included_modules included_modules.should include(DocumentsHelper) ...
true
10e52fcca52a7558b4e36ceaeb41316840983df4
Ruby
HugoArnoult/rails-simple-airbnb
/db/seeds.rb
UTF-8
454
2.796875
3
[]
no_license
require 'faker' puts 'Creating 4 fake flats...' 4.times do flat = Flat.new( name: Faker::Company.name, address: "#{Faker::Address.street_address}, #{Faker::Address.city}", description: Faker::Lorem.paragraph(sentence_count: 2, supplemental: false, random_sentences_to_add: 4), price_per_night: Faker::...
true
1e6b4744550241c968247a404293c884527386be
Ruby
shioimm/til
/activities/20220619_rubykaigi_proposal/drb/a.rb
UTF-8
213
2.75
3
[]
no_license
require "drb" class Foo def greeting(name) "Hello #{name}" end def sum(x, y) x + y end def with_block yield end end foo = Foo.new DRb.start_service("druby://localhost:8082", foo) sleep
true
a89ae4f486244f86f7084c76a14a6aa6e3363258
Ruby
RonaldVilorio/array-CRUD-lab-v-000
/lib/array_crud.rb
UTF-8
654
3.828125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def create_an_empty_array [] end def create_an_array cats = ["bob","ted","zack","brian"] end def add_element_to_end_of_array(array, element) array = [] array << element end def add_element_to_start_of_array(array, element) array = [] array.unshift(element) end def remove_element_from_end_of_array(arra...
true
4635fc2b9a6ae99fab8fbfce8c65d9a2f5697876
Ruby
OrdinaryNick/SimpleRubyJVM
/lib/mrjvm/class_file/reader/modules/attributes/constant_attribute_reader.rb
UTF-8
301
2.640625
3
[ "MIT" ]
permissive
module ConstantAttributeReader def read_constant_attribute(name_index) attribute = {} attribute[:attribute_name_index] = name_index attribute[:attribute_length] = load_bytes(4).to_i(16) # expected is 2 attribute[:constantvalue_index] = load_bytes(2).to_i(16) attribute end end
true
e29622c2bd5201859e2f57b4f1182ba16cbeef2c
Ruby
chichunchen/simrake
/task.rb
UTF-8
491
2.90625
3
[]
no_license
require 'fileutils' class Task attr_accessor :name, :deps, :action def initialize name, deps, &action @name = name if deps.instance_of? Array @deps = deps else @deps = [deps] end @action = action end def has_deps? if deps != [] true else false end end...
true
24f74ff44c67ba1330d3a609991945fad91d59af
Ruby
pauldambra/adventofcode2016
/day_23/spec/add_optimise_spec.rb
UTF-8
748
2.546875
3
[ "CC-BY-4.0" ]
permissive
require_relative('../../assembunny/add_instruction_optimiser.rb') describe "optimizations exist" do it "the computer can collapse to an addition" do new_instructions = AddInstructionOptimiser.optimise([ 'inc b', 'inc a', 'dec c', 'jnz c -2', 'inc b' ]) expect(new_inst...
true
54ad45d03096ed47124bf8f3e834873f868b6e5c
Ruby
luies24/key-for-min-value-den01-seng-ft-080320
/key_for_min.rb
UTF-8
343
3.421875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# prereqs: iterators, hashes, conditional logic # Given a hash with numeric values, return the key for the smallest value def key_for_min_value(name_hash) num_comparison = 5000 lowest_key = nil name_hash.each do |name, num| if num < num_comparison lowest_key = name num_comparison = num end...
true
5b627ffce19495b8e17951c59d3ce087d2ed7b0b
Ruby
chay-chay/CLI-project
/lib/cli.rb
UTF-8
7,804
3.21875
3
[ "MIT" ]
permissive
class Cli @@products = ["blush", "bronzer", "eyeliner", "eyeshadow", "foundation", "lipstick", "mascara", "nail_polish"] attr_accessor :customer def start welcome input_name main end def main choose_product display_products initial_input ...
true
2003fe8a18c00212b649d83d8cff108ff5ab28ca
Ruby
sgonyea/quantity
/lib/quantity/extensions.rb
UTF-8
1,772
2.765625
3
[ "MIT" ]
permissive
module Quantity module Extensions module ClassMethods def once (*methods) #:nodoc: methods.each {|method| module_eval <<-"end;" alias_method :__#{method.to_i}__ , :#{method.to_s} def #{method.to_s}(*args, &block) def self.#{method.to_s}(*args,...
true
ccee5f970207e64f5617794a47efd577b5be3069
Ruby
rock-core/tools-roby
/benchmark/ruby/yield_vs_block.rb
UTF-8
1,285
3.140625
3
[ "LicenseRef-scancode-cecill-b-en", "CECILL-B" ]
permissive
# frozen_string_literal: true require "benchmark" def call_yield(enum) enum.each { |v| yield(v) } # rubocop:disable Style/ExplicitBlockArgument end def call_block(enum, &block) enum.each(&block) end enum = (1..10_000_000) cost_of_call = 10_000_000 call_count = 1_000 call_enum = (1..100) Benchmark.bm(40) do...
true
b1e3b01bab554ec94b9a9be56e7a0505cc72e1a1
Ruby
kudubaba/pillar_babysitter_kata
/lib/babysitter_kata.rb
UTF-8
1,312
3.3125
3
[]
no_license
class Schedule attr_accessor :start, :bedtime, :leave def initialize(start, bedtime, leave) @start = start @bedtime = bedtime @leave = leave end end class Payscale attr_accessor :startrate, :bedtimerate, :latenightrate def initialize(startrate, bedtimerate, latenightrate) @startrate = startra...
true
c9a25c2c127f3e6dbd39870136526ff6afd6c277
Ruby
redpencilio/simple-echo
/echo-server/web.rb
UTF-8
893
2.65625
3
[ "MIT" ]
permissive
require 'net/http' raise "environment variable ECHO_FROM_NAME must be set" if ENV["ECHO_FROM_NAME"].nil? || ENV["ECHO_FROM_NAME"] == "" get "/" do %(<form method="POST" action="/send-ping"><input type="text" placeholder="hostname" name="hostname"/><button type="submit">ping</button></form>) end post "/send-ping" d...
true
99729133e7705b9594e15d9dd5e3efd2c4393f93
Ruby
curquiza/42_logtime
/app/user_logtime.rb
UTF-8
788
3.015625
3
[]
no_license
require_relative 'logtime_calculator' class UserLogtime attr_reader :user, :year, :range def initialize user, params = {} @user = user @year = params[:year] || Time.now.year @range = determine_range params # puts "RANGE = #{ range }\n-----" end def compute LogtimeCalculator.total_logti...
true
985615751b7b02d351bde664338aae672ed32db7
Ruby
Ilya91/rubymind
/app/study/modules.rb
UTF-8
397
3.046875
3
[]
no_license
require_relative 'tools.rb' include Tools class Transport attr_accessor :color, :wheels def sayBip puts 'Bip bip' end end class Cars < Transport attr_accessor :isMechanic end class Moto < Transport attr_accessor :type def sayBip puts 'Rav rav' end end bmw = Cars.new audi = Cars.new moto = Mot...
true