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
f6561467f630b68486ada0af593df41aa4c6e98b
Ruby
martinpoljak/rb.rotate
/lib/rb.rotate/hook.rb
UTF-8
2,895
2.71875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# encoding: utf-8 require "yaml" module RbRotate ## # Represents hook. # class Hook ## # Holds name of the hook. # @name ## # Holds data of the hook. # @data ## # Holds arg...
true
07091074b9ad48a490b0ecfaaae29234ad0c5741
Ruby
corokun/kapeka
/lib/kapeka.rb
UTF-8
315
2.875
3
[ "MIT" ]
permissive
require "kapeka/version" module Kapeka # Your code goes here... def self.fpb(x, y) if x == 0 return y elsif y == 0 return x else self.fpb(y, x%y) end end def self.kpk(x, y) (x*y)/self.fpb(x,y) end end class Fixnum def kpkthis(a) Kapeka.kpk(self, a) end end
true
37e59ca2f79da48fb62e2e00a12c08ed01109b2d
Ruby
SalMac86/ttt-8-turn-ruby-intro-000
/lib/display_board.rb
UTF-8
169
2.609375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def display_board blank = " " row = blank + "|" + blank + "|" + blank puts row puts "-----------" puts row puts "-----------" puts row end display_board
true
f5a9120ac7370d12727e989debfba75c36dcc512
Ruby
anuragsx/payrolls
/app/models/incometax/underground_tax_formula.rb
UTF-8
310
2.640625
3
[]
no_license
class UndergroundTaxFormula < TaxFormula THRESHOLD = 800 def employee_tds EmployeeTaxDetail.for_employee(employee).last end def eligible_for_employee? !!employee_tds end def calculate if eligible_for_employee? return amount - [amount,THRESHOLD].min end amount end end
true
49924b65638e8981c0d8f7ad42748723d95e40e0
Ruby
sebaplawner/pdep-ruby-hitbug
/biblioteca.rb
UTF-8
1,000
2.875
3
[]
no_license
require './contenido' class Biblioteca def initialize tamanioIndividual @biblioteca = [] @tamanioIndividual = tamanioIndividual end def contiene contenido @biblioteca.include? contenido end def superaTamanioIndividual contenido contenido.tamanio > @tamanioIndividual end def rebalsa co...
true
3fdc447a8e1ae07829b074d1eca6b1ff57bc71b6
Ruby
GCHwee/The_Well_Grounded_Rubyist
/modules/mixing_into_class/stack.rb
UTF-8
411
3.296875
3
[]
no_license
# relative вказує місцеположення відносно файла require_relative 'modules/stacklike' puts class Stack include Stacklike end s = Stack.new s.add_to_stack("item_1") s.add_to_stack("item_2") s.add_to_stack("item_3") puts "Object currently on the stack:" puts s.stack taken = s.take_from_stack puts "Removed this obj...
true
c8b6ffce0572a0cd7fbee1a2e5e35d2945dd1223
Ruby
fierytortilla/week04_day02_lab_hw
/sinatra_calc/sinatra_calc_start/controller.rb
UTF-8
877
2.734375
3
[]
no_license
require('sinatra') require('sinatra/contrib/all') require_relative('models/calculator') also_reload('./models/*') # get('/add/:num1/:num2') do # return "The add result is #{Calculator.add(params[:num1].to_i, params[:num2].to_i)}" # end get('/root/:num1/:num2') do return "The nth root (where n equals #{params[:nu...
true
e98093fe9f8d91159b6db022759f68deb5b70597
Ruby
lucianboatright/Ruby_Notes_examples
/Ruby_Makers_quiz.rb
UTF-8
43,268
4.375
4
[]
no_license
######## CHAPTER 10 Working # class Todo # def initialize(todo) # @todo = todo # end # def text # @todo # end # end # class TodoList # def initialize # @todo_list = [] # end # def add(todo) # @todo_list.push(todo) # end # def print # @todo_list.each do |word| # word ...
true
28a28ea8aca0796a7e4fea538cabe7d59f61d091
Ruby
MatzFan/bookmarks
/spec/features/adding_links_spec.rb
UTF-8
1,295
2.5625
3
[]
no_license
require 'spec_helper' feature 'User adds a new link' do scenario "from the homepage using an ajax form", :js => true do visit '/' click_link "New link" add_link("http://www.example.com/", "Example") expect(page).to have_content('Example') expect(current_path).to eq('/') # we're still on the front...
true
940886c494ed6a2077c735be0405958129a6a288
Ruby
vigneshjb/youtour
/lib/tasks/sample_data.rake
UTF-8
1,456
2.53125
3
[]
no_license
require 'faker' namespace :db do desc "Fill database with sample data" task :populate => :environment do Rake::Task['db:reset'].invoke make_users make_tours make_trips end end def make_users User.create!(:username => "sample@youtour.com", :password => "test", :password_...
true
3f18f8a34766d15c7314eef125754df059a35ba0
Ruby
audiac/tealeaf-intro
/companion_workbook/advanced/quiz1/ex3.rb
UTF-8
183
3.078125
3
[]
no_license
# ex3.rb puts "A) one is: 'one'\ntwo is: 'two'\nthree is: 'three'" puts "B) one is: 'one'\ntwo is: 'two'\nthree is: 'three'" puts "C) one is: 'two'\ntwo is: 'three'\nthree is: 'one'"
true
131ee5477d25ed663e03d2525900ca9d19e5d118
Ruby
engineyard/rails_dev_directory
/vendor/rails/activesupport/lib/active_support/core_ext/array/wrapper.rb
UTF-8
591
2.734375
3
[ "MIT" ]
permissive
module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Array #:nodoc: module Wrapper # Wraps the object in an Array unless it's an Array. Converts the # object to an Array using #to_ary if it implements that. def wrap(object) case object when...
true
3d74c9961b59792c626dd59516c7950fa026cc71
Ruby
matthew-puku/ruby-challenges
/tests/16_palindrome_test.rb
UTF-8
240
2.8125
3
[]
no_license
# Add tests to me :D require 'test/unit' require_relative '../16_palindrome' class PalindromeTest < Test::Unit::TestCase def test_palidrome assert_true(palindrome("racecar")) assert_false(palindrome("hello")) end end
true
2aab3611db375518534ecf13a9066f746ad43927
Ruby
thelornenelson/oop-math-game
/math_game.rb
UTF-8
1,520
4.0625
4
[]
no_license
require './player' class MathGame def initialize @starting_lives = 3 @players = [Player.new(@starting_lives), Player.new(@starting_lives)] @max_question_number = 20 self.start_game end def start_game current_player = 0 loop do current_player %= 2 answers = self.ask_questio...
true
0a2310e574692fafe01a29c9228c057f3d0cb519
Ruby
FelixAlvarado/aA-homeworks
/W2D1/simon/lib/simon.rb
UTF-8
1,129
3.734375
4
[]
no_license
class Simon COLORS = %w(red blue green yellow) attr_accessor :sequence_length, :game_over, :seq def initialize @sequence_length = 1 @game_over = false @seq = [] end def play until @game_over take_turn end game_over_message reset_game end def take_turn show_sequence ...
true
f14fb7fda34c6a943d74646ae428e28ac85a9877
Ruby
malorie16/OO-mini-project-dumbo-web-051418
/app/models/Allergen.rb
UTF-8
168
2.875
3
[]
no_license
class Allergen attr_reader :ingredient @@all=[] def initialize(ingredient) @ingredient=ingredient @@all << self end def self.all @@all end end
true
0bf1bc77f2bfb6dc2c7a3a5b78109b742d1e0dad
Ruby
anfinil/activity-feed
/spec/support/shared/models.rb
UTF-8
1,630
2.703125
3
[ "MIT" ]
permissive
module ActivityFeed module Backend srand(1098010932048023984029) class FakeBackend include Backend ActivityFeed::User::Collection::FORWARDED_METHODS.each do |method| self.send(:define_method, method) do |*args| puts "#{self.inspect}: method: #{method} args: #{args}" end...
true
05063e93b07f8c4b049c0a357b1e792646c82aff
Ruby
hvilloria/Hack
/semana5/dia1/tienda/tienda.rb
UTF-8
1,391
3.078125
3
[]
no_license
require 'rest-client' require 'json' class Tienda def self.parsing link=RestClient.get('https://hack-stores-api.herokuapp.com/stores/22',{:params => {token: "nXeYvnFinShXEZu8x7yRmw"}}) puts link end def modificar_nombre link=RestClient.put 'https://hack-stores-api.herokuapp.com/stores/22',{'store': {'na...
true
5e2b2a7572f4db22a7b547fb761df810ca879131
Ruby
emanon001/atcoder-ruby
/abc063/c/main.rb
UTF-8
394
2.734375
3
[]
no_license
N = gets.to_i S = N.times.map { gets.to_i } MAX_S = N * 100 dp = Array.new(N + 10) { Array.new(MAX_S + 10, false) } dp[0][0] = true N.times do |i| s = S[i] (0..MAX_S).each do |j| if j - s < 0 dp[i + 1][j] = dp[i][j] else dp[i + 1][j] = dp[i][j] || dp[i][j - s] end end end ans = 0 (0..MAX_...
true
8ddeafdd3612ce3316217c2eef630abf79bed958
Ruby
nghong/project-euler
/test/test_largest_palindrome.rb
UTF-8
410
2.828125
3
[]
no_license
require_relative "../largest_palindrome" require "minitest/autorun" class TestLargestPalindrome < Minitest::Test def test_that_9009_is_largest_palindrome_made_from_product_of_two_2digit_numbers assert_equal 9009, largest_palindrome(10, 99) end def test_that_906609_is_largest_palindrome_made_from_produc...
true
029eb81ad1741e106e2b00fa35e6118031140f51
Ruby
dwiesenberg/project_sinatra_dashboard
/z_solution_project_sinatra_dashboard_Chris_Bideo/lib/yaml_saver.rb
UTF-8
210
2.640625
3
[]
no_license
require 'yaml' class YAMLSaver def save(filename, object) data = object.to_yaml path = "#{File.dirname(__FILE__)}/data/#{filename}.yaml" File.open(path, 'w') do |file| file.write(data) end end end
true
a433291e1431444a5c8b06f62e12e8460d29b977
Ruby
motikan2010/NamaTube
/app/controllers/concerns/service/video_service.rb
UTF-8
2,974
2.609375
3
[]
no_license
require 'unf' module Service::VideoService extend ActiveSupport::Concern include Util::YoutubeApiUtil include Util::AnalyzeEntityUtil # ビデオの検索 def search_video(params) if params[:t] # タグ検索 tag = Tag.where(:name => params[:t]).first tag.videos elsif params[:k] # キーワード検索 ...
true
e74bdc805f2ec791a477fa310f42aee2a06ce88d
Ruby
tomekw/hash_assertions
/spec/hash_assertions/assert_required_keys_spec.rb
UTF-8
1,142
2.65625
3
[ "MIT" ]
permissive
require "spec_helper" require "hash_assertions/assert_required_keys" describe "assert_required_keys" do let(:hash) { { foo: "bar", baz: "qux" } } context "when all required keys in hash" do let(:required_keys) { [:foo, :baz] } it "passes" do expect { hash.assert_required_keys(*required_keys) }.to_n...
true
ef527c44ab683d4de67a1078bbe4b66a4f092e15
Ruby
DouglasAllen/code-Programming_Ruby_3rd_ed
/Part_IV--Ruby_Library_Reference/ch27_Built-in_Classes_and_Modules/Alphabetical_Listing/Array/Array_instance_methods/%26-i.rb
UTF-8
428
3.609375
4
[]
no_license
=begin Array#& (from ~/.rdoc) ------------------------------------------------------------------------------ ary & other_ary -> new_ary ------------------------------------------------------------------------------ Set Intersection---Returns a new array containing elements common to the two arrays, with no d...
true
47f4b93a0df031d38b3ac993d27f254ae350e725
Ruby
HaChan/blog_oop
/spec/models/post_spec.rb
UTF-8
2,550
2.5625
3
[]
no_license
require "minitest/autorun" require "active_model" require_relative "../spec_helper_lite" require_relative "../../app/models/post" describe Post do subject{@post = Post.new} it "starts with blank attributes" do subject.title.must_be_nil subject.body.must_be_nil end it "supports reading and writing a t...
true
80f3f8973b7e1d718878e083f06d6d1bdc74893d
Ruby
v21/Sweareoke
/bad ruby/play.rb
UTF-8
1,046
2.9375
3
[]
no_license
#!/usr/bin/ruby require 'fuck' if (ARGV.length != 1) then puts "go away" exit end word = ARGV[0] puts "playing with #{word}" SDL.init(SDL::INIT_AUDIO | SDL::INIT_JOYSTICK | SDL::INIT_VIDEO) SDL::Mixer.open @fuck_sounds = [] @guitar = nil def poll_events while event = SDL::Event.poll case event when SDL::...
true
c44a59b0ba35d5d8b98326b9a535e974040c0f3f
Ruby
gentoid/music_comparator
/lib/music_comparator/cli.rb
UTF-8
4,404
2.59375
3
[]
no_license
require 'thor' require 'colorize' require 'config' require 'condition' require 'corrector' require 'database' require 'files' require 'models/mp3_info' require 'parallel' module MusicComparator class Cli < Thor desc 'scan', 'Scan directory and DB for differences' def scan compute_changes output...
true
4c0518fcee83b63eac9310099a190890c67af824
Ruby
paulopatto/foot_stats
/lib/foot_stats/error_response.rb
UTF-8
1,320
2.875
3
[ "MIT" ]
permissive
module FootStats class ErrorResponse include Enumerable attr_reader :message # <b>Respect the contract with the Resource Instance and Resource Collections.</b> # This method is useful when you want to store the response in your database or # log this in your own way. # attr_reader :respon...
true
706569104f823ff6a6d06b309d038fe6862588a6
Ruby
lisbethmarianne/ruby-project
/08_book_titles/book_titles.rb
UTF-8
274
3.40625
3
[]
no_license
class Book def title @title end def title=(name) array = name.split array.each do |word| word.capitalize! unless ["and", "or", "a", "to", "in", "the", "of", "an"].include?(word) end array[0].capitalize! @title = array.join(" ") end end
true
0b7879adfb7baf14cbf4dbca9c8eb184cd31595a
Ruby
liulikun/tsds
/spec/models/train_station_spec.rb
UTF-8
4,059
2.546875
3
[]
no_license
require 'spec_helper' describe TrainStation do it 'should do' do office = Geokit::Geocoders::GoogleGeocoder.geocode('Southern Cross Station, Melbourne VIC 3000, Australia') office = Geokit::Geocoders::GoogleGeocoder.geocode('Melbourne Central Station, Melbourne VIC 3000, Australia') p office p office...
true
e2c3f355cec2eef0b5537288254ee7c433d82f84
Ruby
shinosakarb/pair_programming
/20150926/kytiken_rito/draque/bin/draque.rb
UTF-8
469
2.96875
3
[]
no_license
#!/usr/bin/env ruby $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'draque' monster = Monster.new('スライム') puts "#{monster.name}が現れた!" puts hero = Hero.new loop do hero.action_list.each do |action| puts "#{action[0]}. #{action[1]}" end print 'コマンドを入力してください? ' input_command = gets.to_i ...
true
17e831ba3f1739939f2be0307262315f528ee494
Ruby
alto/aasm
/lib/aasm/base.rb
UTF-8
2,262
2.671875
3
[ "MIT" ]
permissive
module AASM class Base def initialize(clazz, options={}, &block) @clazz = clazz sm = AASM::StateMachine[@clazz] sm.config.column = options[:column].to_sym if options[:column] if options.key?(:whiny_transitions) sm.config.whiny_transitions = options[:whiny_transitions] elsif...
true
ee5fb2fb1f521cc822980c8b6a69465940aa6429
Ruby
takagotch/ruby
/perfect_auth/sample_files/part3/06/list6.11.rb
UTF-8
324
2.640625
3
[]
no_license
# coding: utf-8 module IncludedModule def included_module_method :included_module_method end end class Klass include IncludedModule define_method :included_module_method, IncludedModule.instance_method(:included_module_method) end object = Klass.new object.included_module_method #=> :included_module_met...
true
2a1ea6e5b6b360abe7b567634b4e6ef484ebb4c9
Ruby
gustavowt/ruby-nmap
/lib/nmap/status.rb
UTF-8
548
2.96875
3
[ "MIT" ]
permissive
module Nmap class Status # The state of a host attr_reader :state # The reason for the state attr_reader :reason # # Creates a new Status object. # # @param [Symbol] state # The state of a host. # # @param [String] reason # The reason for the state. # def...
true
21efe5c02812f0c5b39c556bd678d4b8791a46ff
Ruby
Scott-Borecki/mastermind
/lib/game.rb
UTF-8
2,537
3.34375
3
[]
no_license
class Game attr_reader :guess, :guess_count, :message, :sequence, :timer def initialize(message, sequence, timer) @guess_count = 0 @guess = "" @message = message @sequence = sequence @timer = timer end def start_input @input = gets.chomp.downcase case @input when "p", "play" ...
true
69b152b3a79b15db02dbcfbdc395caee67c89795
Ruby
theorygeek/yogurt
/lib/yogurt/code_generator/enum_class.rb
UTF-8
1,493
2.515625
3
[ "Apache-2.0" ]
permissive
# typed: strict # frozen_string_literal: true module Yogurt class CodeGenerator # For GraphQL enum classes class EnumClass < T::Struct extend T::Sig include Utils include DefinedClass const :name, String const :serialized_values, T::Array[String] sig {override.returns(T:...
true
733f4239d6a3610eb0c96b2ec516b2474ab2317d
Ruby
compwron/minesweeper
/lib/game.rb
UTF-8
532
3.203125
3
[ "MIT" ]
permissive
require_relative 'board' class Game attr_reader :in_progress def initialize(board_size, bomb_count) @board = Board.new(board_size, bomb_count) @in_progress = true end def reveal(x, y) cell = @board.reveal(x, y) if cell.is_bomb? @in_progress = false @board.reveal_all elsif @boar...
true
8b70860f81103ce2f85be761b8debca0d9d0dc06
Ruby
larger96/sub-strings
/sub_strings.rb
UTF-8
1,023
4.53125
5
[]
no_license
=begin Implement a method #substrings that takes a word as the first argument and then an array of valid substrings (your dictionary) as the second argument. It should return a hash listing each substring that was found in the original string and how many times it was found. Create a dictionary of substrings....
true
c5432fb304adcefb894173852927569893f35409
Ruby
marco-t/onetwenys
/model/kit.rb
UTF-8
197
2.96875
3
[]
no_license
class Kit attr_accessor :cards def initialize @cards = [] end def add_card(card) @cards << card end def remove_cards cards = @cards @cards = [] cards end end
true
2aa3d4b98f59fc7f47655f9c5b1a6a385b4a9b01
Ruby
piasf/oo-tic-tac-toe-v-000
/lib/tic_tac_toe.rb
UTF-8
1,613
3.890625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class TicTacToe def initialize(board=nil) @board= board || Array.new(9, " ") end WIN_COMBINATIONS = [ [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [2,4,6] ] def display_board puts " #{@board[0]} | #{@board[1]} | #{@board[2]} " puts "-----------" ...
true
0e7d72c04da077acca6500774712e6c17d224b67
Ruby
mmanousos/ruby-small-problems
/small_problems/easy9/nine_grade_book.rb
UTF-8
1,916
4.65625
5
[]
no_license
=begin *assignment* Grade book Write a method that determines the mean (average) of the three scores passed to it, and returns the letter value associated with that grade. Numerical Score Letter Grade 90 <= score <= 100 'A' 80 <= score < 90 'B' 70 <= score < 80 'C' 60 <= score < 70 'D' 0 <= s...
true
ab670e920fb32e0a8927e70634400953b2a3bcdb
Ruby
Diazware12/GIGIH_BE_Bangsa
/module7/session1/part2/circle.rb
UTF-8
157
3.3125
3
[]
no_license
class Circle attr_accessor :radius def initialize(radius) @radius = radius end def getArea Math::PI * @radius** end end
true
bd456d7c28f9d4d10e13db1002b7db8c4d19f602
Ruby
yungdai/Ruby-Fundamentals-Part-2
/arrays.rb
UTF-8
1,047
4.46875
4
[]
no_license
empty_array = [] numbers = ["one", "two", "three", "four", "five"] # 0 1 2 3 4 puts"dereferencing the value two with numbers[1] and last with numbers[4]" two = numbers[1] # dereference the value stored at index 1 last = numbers[4] puts two puts last puts "This is what happens when ...
true
6eedd92892a72ea3ad189bec0ad04fe28be21936
Ruby
clint7/Sandpit-Ninjas
/main.rb
UTF-8
2,111
2.546875
3
[]
no_license
require 'sinatra' require 'json' require 'sinatra/activerecord' class MyApp < Sinatra::Base get '/' do send_file File.join('public', '/index.html') end get '/test_api' do content_type :json { :key1 => "dope", :key2 => 'value2' }.to_json end get '/get_locs' do content_type :json locs =...
true
448bf4daa65eafc189514fa2bd1d6e1a290fa3ee
Ruby
sand33pn/ruby-codes
/year.rb
UTF-8
1,929
3.9375
4
[]
no_license
puts "Enter first person's name :" first = gets.chomp puts "Enter second person's name :" second = gets.chomp puts "Enter #{first}'s birth year(yyyy) :" first_year = gets.chomp.to_i puts "Enter #{first}'s birth month(mm) :" first_month = gets.chomp.to_i puts "Enter #{first}'s birth day(dd) :" first_day = gets.chomp.to...
true
7aba229df8e858a08eb78b0ced35dfa5060e9838
Ruby
onisan/ruby-tutor
/coding-test-2/practice-problems/lib/03_ordered_vowels.rb
UTF-8
560
3.515625
4
[]
no_license
def ordered_vowel_words(str) ord = str.split(' ') bad = [] ord.each {|s| tmp = "" tmp.concat(s) bad.push(s) unless ordered_vowel_word?tmp } bad.each {|b| ord.delete(b) } return ord.join(" ").chomp #if ordered_vowel_word?str end def ordered_vowel_word?(word) chars = [] while(word.slice(/[aei...
true
c9e6aa80e5b044762c898b0e732200c624b34f5a
Ruby
activescaffold/active_scaffold
/lib/active_scaffold/data_structures/columns.rb
UTF-8
3,517
2.875
3
[ "MIT" ]
permissive
module ActiveScaffold::DataStructures class Columns include Enumerable include ActiveScaffold::Configurable # The motivation for this collection is that this Columns data structure fills two roles: it provides # the master list of all known columns, and it provides an inheritable list for all other a...
true
5706451b00b7763b6f737c15dba2931664dfebbd
Ruby
jasonayre/rpg_codetest
/lib/rbrpg/computer.rb
UTF-8
359
2.765625
3
[ "MIT" ]
permissive
module Rbrpg class Computer attr_accessor :hero, :name def initialize(hero_type:, name:) @hero_type = hero_type @hero = hero_class.new @name = name end def valid_targets [ @hero ] end private def hero_class @hero_class ||= "rbrpg/characters/#{@hero_type}"....
true
9593f8d99285307a94f3805ccf2720c5becfe045
Ruby
marten/path_notifier
/lib/path_notifier/location_trigger.rb
UTF-8
2,222
2.5625
3
[ "MIT" ]
permissive
module PathNotifier class LocationTrigger def self.trigger # First, update coordinates PathNotifier::GeoloqiImporter.update(Models::Coordinate.latest.timestamp) current_coord = Models::Coordinate.latest # Next, find place associated with trigger location current_place = Models::Pla...
true
3d81a5118e559532aa7d00629c041f8feee72ccd
Ruby
saulo-lir/curso-ruby_e_ruby-on-rails
/curso-ruby/02-ruby-poo/09-constantes_e_classes_constantes.rb
UTF-8
348
3.03125
3
[]
no_license
# As variáveis são declaradas com letras minúsculas # As constantes são declaradas com letras MAIÚSCULAS # As constantes não mudam o valor em todo o sistema # Definindo uma classe constante class Teste PI = 3.14 NOME_APP = "Sistema de CRM" NOME_CLIENTE = "Fulano de Tal" end puts Teste::PI puts Teste::NOME...
true
e1bf98f9744b8e5e37b0d6d3c5f15b825afed5ed
Ruby
SahamAK/phase-0-tracks
/ruby/iteration.rb
UTF-8
2,449
4.1875
4
[]
no_license
#5.3 Mandtory pairing : Iteration #names: Saham Khozestani and Mike Tsou # Release 0 # iterating without parameter 5.times do puts "This is a test" end puts " " # iterating with parameter 3.times do |x| puts x + x end puts " " # one line block 4.times {|x| puts x + x} puts " " # Release 1 array ...
true
679782de99f1d11af908532d23241ec3ba8476c8
Ruby
chang-ryan/ruby-building-blocks
/bubble_sort.rb
UTF-8
782
3.90625
4
[]
no_license
def bubble_sort(numbers) swapped = true while swapped swapped = false for i in (0...numbers.size-1) if numbers[i] > numbers[i+1] numbers.insert(i, numbers.delete_at(i+1)) swapped = true end end end numbers end p bubble_so...
true
4fc23960e330dfd1b661611d8f3d4a5008db0e2d
Ruby
jasont01/chess
/lib/legality.rb
UTF-8
726
3.0625
3
[]
no_license
require_relative 'pieces/pieces.rb' module Legality def legal_move?(board, start, finish) return false if squares_legal?(board, start, finish) == false return false if in_moveset_and_unblocked?(board, start, finish) == false true end def in_moveset_and_unblocked?(board, start, finish) piece = b...
true
12b87306920b8623e7a7b2f2b434a8cbd8ca0913
Ruby
nicky90/code2html
/code2html.rb
GB18030
2,649
2.765625
3
[]
no_license
$path = ARGV[0] if ($path == nil || !File.exists?($path)) puts "Usage: code2html pathname" exit(-1) end $gid = 10000 #ļ $links = "" #Ŀ¼ $content = "" #ɵhtml $file2gid = {} #ļӦgidĿ¼htmlеļ #htmlбת룬<֮಻ʾ def html_escape(s) s.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;") end def u...
true
293186856c7ff9377e6eea646282c88999715d83
Ruby
sainu/atcoder
/contests/abc145/a.rb
UTF-8
259
2.859375
3
[]
no_license
# frozen_string_literal: true require 'bundler/setup' require 'pry' # ----- ここから下が提出コード ----- def gi; gets.to_i end def gs; gets.chomp end def gli; gets.split(' ').map(&:to_i) end def d(n); Math.log10(n).to_i + 1 end r = gi puts r**2
true
541f0ae9e13ec31147abadef08d3af5340caf88b
Ruby
zoer/xmlable
/lib/xmlable/types.rb
UTF-8
652
2.53125
3
[ "MIT" ]
permissive
XMLable::Builder.tap do |b| b.define_type :string, :str, String do cast { |val| val.to_s } end b.define_type :integer, :int, Integer do cast { |val| val.to_i } export_to_json { |val| val } end b.define_type :float, Float do cast { |val| val.to_f } export_to_json { |val| val } end b...
true
0d032e477b96476535916ceabba228ccc97a9d9b
Ruby
stanimirvasilev/prework-videos-intro-to-tests-online-web-sp-000
/conversions.rb
UTF-8
91
3.15625
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def ounces_to_grams(ounces) unces_to_grams = 28.3495 ounces.to_f * unces_to_grams end
true
912f41bab98623598ef212c6ec7775e1a5f9f3fc
Ruby
jcsky/ruby-excise
/classes_and_objects_part1/ex1.rb
UTF-8
485
3.703125
4
[]
no_license
class MyCar attr_accessor :color def initialize(year, color, model) @year = year @color = color @model = model @speed = 0 end def speed_up @speed = @speed+1 puts "speed is #{@speed}" end def brake (@speed>0)? @speed = @speed-1 : @speed = 0 puts "speed is #{@speed}" end d...
true
3cb8430a6bba9cbdbe068849662bcacdb7210863
Ruby
esminc/rubyagile
/config/initializers/core_ext.rb
UTF-8
167
2.53125
3
[ "MIT" ]
permissive
class Date private def feed_utils_to_time(dest, method) Time.send(method, dest.year, dest.month, dest.day, dest.hour, dest.min, dest.sec, dest.zone) end end
true
856c68ac525a4af5b3220f4363d341e741effd55
Ruby
govaniso/phidgets-ffi
/lib/phidgets-ffi/led.rb
UTF-8
3,885
2.8125
3
[]
no_license
module Phidgets # This class represents a PhidgetLED. class LED Klass = Phidgets::FFI::CPhidgetLED include Phidgets::Common # Collection of LEDs # @return [LEDOuputs] attr_reader :leds attr_reader :attributes # The attributes of a PhidgetLED def attributes super.merge({ ...
true
d3d2a80645551b32a30056fe3d88131b8df5422c
Ruby
gerndtr/ruby_practice
/pract2.rb
UTF-8
1,006
3.96875
4
[]
no_license
# def division (x, y) # ans = x / y # end # puts "How many people want a pair of cards?" # count == gets.chomp.to_i # puts "And the second one is..." # y = gets.chomp.to_i # if x == 0 || y == 0 # puts "Sorry, they cannot be zero. Try again." # division # elsif # x !=...
true
31edcc7c0528705a08f5bb1b459aba64aa26887d
Ruby
trevorbennett/mathematical-properties-of-card-shuffles
/lib/application.rb
UTF-8
95
2.734375
3
[ "Apache-2.0" ]
permissive
require_relative("weighted_deck") deck = WeightedDeck.new(52) puts(deck.size) puts(deck.deck)
true
a922091a330bd72dc7070489ad210f9c0c95ca33
Ruby
BurdetteLamar/minitest_log
/lib/helpers/array_helper.rb
UTF-8
744
2.59375
3
[ "MIT" ]
permissive
require 'diff/lcs' class ArrayHelper # Compare two arrays. def self.compare(expected, actual) sdiff = Diff::LCS.sdiff(expected, actual) changes = {} action_words = { '!' => 'changed', '+' => 'unexpected', '-' => 'missing', '=' => 'unchanged' } sdiff.each_with_in...
true
b09b3ec53cee0ed7e2f6fd729f2c08cd27ee398f
Ruby
FillanL/keys-of-hash-nyc-web-career-031119
/lib/keys_of_hash.rb
UTF-8
241
3.1875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Hash def keys_of(*arguments) return_val = [] arguments.each do |item| self.each do |k, v| if item == v return_val << k end end end return_val end end
true
ca71faf920097f9fd3c9f8150382c9ce6b6d727f
Ruby
auranet/asapccf
/lib/asap/adt/gis/geographic_rectangle.rb
UTF-8
5,037
2.5625
3
[]
no_license
module ASAP module ADT module GIS class GeographicRectangle < GeographicPointContainer define_accessors :corners => {:type => Array, :required => true, :validator => lambda {|value| value.size == 2 && valu...
true
e02515ba627d23f45b9d6d09749734cd18159717
Ruby
philipluk/aspera-cli
/lib/aspera/cli/manager.rb
UTF-8
18,079
2.84375
3
[ "Apache-2.0" ]
permissive
require 'aspera/colors' require 'aspera/log' require 'aspera/cli/extended_value' require 'optparse' require 'io/console' module Aspera module Cli # raised by cli on error conditions class CliError < StandardError; end # raised when an unexpected argument is provided class CliBadArgument < CliError; ...
true
b30556124ad9e05565895902e48d590a26d54a7d
Ruby
cameronjkelley/exercism
/ruby/raindrops/raindrops.rb
UTF-8
223
2.984375
3
[]
no_license
class Raindrops RAINDROPS = { "Pling" => 3, "Plang" => 5, "Plong" => 7 } def self.convert(num) result = RAINDROPS.select { |_key, value| num % value == 0 }.keys.join result.empty? ? num.to_s : result end end
true
e8d2c856fae259271e48b330ad35188e23638f2f
Ruby
marina-ferreira/poodr
/chapter_3/remove_argument_order_dependencies.rb
UTF-8
709
3.703125
4
[]
no_license
# Bad 🤢 # A message that requires arguments creates a dependency. Not only on the name # of the arguments, but also on their order. class Gear attr_reader :chainring, :cog, :wheel def initialize(chainring, cog, wheel) @chainring = chainring @cog = cog @wheel = wheel end end Gear.new(52, 11 Wheel.n...
true
fc20a5f82faccfdf1ca7613e18d56c9c607cc8fb
Ruby
recroot89/exercism
/ruby/matrix/matrix.rb
UTF-8
354
3.421875
3
[]
no_license
# frozen_string_literal: true class Matrix attr_reader :matrix def initialize(raw_data) @matrix = raw_data.split(/\n/) end def rows matrix.map { |m| m.split(' ').map(&:to_i) } end def columns (0..matrix.size - 1).reduce([]) do |acc, index| new_col = rows.map { |r| r[index] } acc....
true
71baf3ae46a160ed2589b263fd262c780e27a3bb
Ruby
dhuh/sample_app
/shuffle.rb
UTF-8
64
2.515625
3
[]
no_license
class String def shuffle s.split('').shuffle.join end end
true
9658e2ebd0d9b1d46c28d4697e411ee16227e13c
Ruby
J-Y/RubyQuiz
/ruby_quiz/quiz126_sols/solutions/Daniel Martin/fizzbuzz2.rb
UTF-8
1,364
3.4375
3
[ "MIT" ]
permissive
# A> I CAN HAS INTERVIEW? I ARE ADVANCED PROGRAMMER. # # B> O HAI. U CAN HAS CALLCC? GIMMEH FIZZBUZZ SOLUTION! f_=b_=nil callcc { |o| loop do o = callcc {|i|f_=i; o[:Fizz]} 2.times{o = callcc{|i|f_=i;o[]}} end } callcc { |o,n| loop do o,n = callcc {|i|b_=i; o["#{n}Buzz"]} 4.times{o,n = callcc{|...
true
ef6a7ce45f71d89be758d5c358d7927f1b9984a6
Ruby
samsara/samsara
/clients/ruby/lib/samsara_sdk/client.rb
UTF-8
2,044
2.984375
3
[ "Apache-2.0" ]
permissive
require 'samsara_sdk/config' require 'samsara_sdk/publisher' require 'samsara_sdk/ring_buffer' require 'samsara_sdk/event' # Samsara SDK module SamsaraSDK # A client for ingesting events into Samsara. # It is the main interface to communicate with Samsara API. class Client # initialize # # @param con...
true
b80cedddecd0b4d038e8af1a796ee044db14d780
Ruby
deanscottg/programming-univbasics-4-crud-lab-nyc01-seng-ft-080320
/lib/array_crud.rb
UTF-8
851
3.828125
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def create_an_empty_array empty_array = Array.new end def create_an_array four_empty_array = Array.new(4) end def add_element_to_end_of_array(array, element) array.push(element) p array end def add_element_to_start_of_array(array, element) array.unshift(element) p array end def remove_element_from_en...
true
f20600864ebdc5ac96c58580c5e8b3ff43e942c4
Ruby
alanlong9278/bindo-test
/data/generate_data.rb
UTF-8
521
3.21875
3
[ "MIT" ]
permissive
require 'json' def get_random_string(random_length) o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten (0...random_length).map { o[rand(o.length)] }.join end rb_hash = JSON.parse('{ "data": []}') (0...200).map do |number| id = number name = get_random_string(5) age = rand(100) phone = (0...13).map { rand(9)...
true
426ead8bc5f0500c110b47f913eecb4530f8213c
Ruby
mikisvaz/xmipp-www
/lib/xmipp.rb
UTF-8
1,551
2.546875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module XMIPP BIN_DIR = File.join(ENV['HOME'], 'software', 'opt', 'xmipp', 'bin') DEFAULT_OPTIONS = { "sigma" =>1.5, "initialSeeds" =>300, "growSeeds" =>30, "stop" =>0.001, "targetError" =>0.02, "dontAllowMovement" => false, "dontAllowIntensity" => false, "intensityColumn" => "occup...
true
cf8c76ced74e5df101e13e8f57d995d6606561a8
Ruby
kohbis/leetcode
/algorithms/1252.cells-with-odd-values-in-a-matrix/solution.rb
UTF-8
441
3.203125
3
[]
no_license
def odd_cells(n, m, indices) matrix = Array.new(n) { Array.new(m, 0) } count = 0 # apply the increment to all indices indices.each do |ind| ri, ci = ind[0], ind[1] # row matrix[ri].map! { |cell| cell = cell + 1 } # column matrix.each { |row| row[ci] = row[ci] + 1 } end # matrix.flatten...
true
97dce2807ec481d7d2ffe37afc699bb1bfb2d29c
Ruby
vuonga1103/ruby-oo-object-relationships-collaborating-objects-lab-nyc04-seng-ft-053120
/lib/song.rb
UTF-8
585
3.203125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" class Song attr_accessor :name, :artist @@all = [] def initialize(name) @name = name @@all << self end def self.all @@all end def artist_name=(artist_name_str) artist_object = Artist.find_or_create_by_name(artist_name_str) artist_object.add_song(self) end def se...
true
7c755c772b1df6dd5d044b4b27563abdb3fd1c41
Ruby
DouglasAllen/code-Programming_Ruby_3rd_ed
/Part_IV--Ruby_Library_Reference/ch27_Built-in_Classes_and_Modules/Alphabetical_Listing/Object/nil%3f-i.rb
UTF-8
331
2.71875
3
[]
no_license
=begin Object#nil? (from ~/.rdoc) ------------------------------------------------------------------------------ nil?() ------------------------------------------------------------------------------ call_seq: nil.nil? -> true <anything_else>.nil? -> false Only the object nil responds true to ...
true
69f7bda097b983f25b2469752d96797723e109b3
Ruby
kotikan/isis
/plugins/koticast/koticast.rb
UTF-8
1,012
2.796875
3
[]
no_license
# Returns the current weather forecast for Kotikan HQ require 'forecast_io' require 'yaml' class Koticast < Isis::Plugin::Base def respond_to_message?(message) @commands = message.downcase.split %w(!koticast !kotikast !willitrain !scanthesky).include? @commands[0] end def response_html forecast =...
true
c897b91096b83b8d332f900e4af58c58ab2b131e
Ruby
chaosdorf/mete
/app/controllers/wrapped_controller.rb
UTF-8
2,639
2.546875
3
[ "MIT" ]
permissive
class WrappedController < ApplicationController # GET /user/1/wrapped def index @user = User.find(params[:user_id]) @years = Date.today.year.downto(2010) .select { |y| audits_for(@user, y).any? } # index.html.haml end # GET /users/1/wrapped/1970 def show @user = User.find(params[:user...
true
5b7106cd460abd6ac974cd5c57cf9464003c08b3
Ruby
Katy600/oyster_card_day4
/spec/journey_spec.rb
UTF-8
463
2.5625
3
[]
no_license
require 'journey' describe Journey do let(:bank) {double :bank, name: "bank", zone: 3} let(:angel) {double :angel, name: "angel", zone: 1} subject(:journey) {described_class.new(bank)} it 'has an entry station' do expect(journey.entry_station).to eq bank end context 'after touching out' do before...
true
db1dc258cd03e4b43d033a0141f427aab3c62d17
Ruby
handiwiguna/alexa_rubyengine
/lib/alexa_rubyengine/verse_of_the_day_intent.rb
UTF-8
1,342
3.015625
3
[ "MIT" ]
permissive
#encoding: UTF-8 require 'date' require 'alexa_rubykit' class VerseOfTheDayIntent attr_reader :response VERSES = [ "John 3 verse 16. For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life", "Jeremiah 29 verse 11. For I know the p...
true
8a6a27d6203326d8870c676de07e0813dfd90b04
Ruby
hguitton/fs-hiring-test
/db/seeds.rb
UTF-8
1,478
2.796875
3
[ "MIT" ]
permissive
User.destroy_all Booking.destroy_all Room.destroy_all Motel.destroy_all # Create 3 users user2 = User.create(email: "user@two.dev", password: "123456") user1 = User.create(email: "user@one.dev", password: "123456") User.create(email: "user@none.dev", password: "123456") def motels_url "https://luvotels-hiring-api...
true
fc7a176e9b08ad62708f59141844ea6e13b8a154
Ruby
antwebes/IrcSocket
/lib/com.adobe.lccs/sampleApps/ExternalAuthentication/rails/lib/lccs.rb
UTF-8
35,029
2.5625
3
[]
no_license
#!env ruby # # = Synopsis # # This library allows you to connect to the Adobe LiveCycle Collaboration Service and # manage an account, including listing rooms and templates, creating new rooms, and # deleting rooms and templates. # # == Examples # # require 'lccs' # # # # # Create a new account manager object us...
true
79af87baddef40f5980edc36a0994a601522141f
Ruby
henriquegavabarreto/sokoban
/lib/game_objects/helpers/movable.rb
UTF-8
3,045
3.5625
4
[]
no_license
require_relative './positioning' class Movable include Positioning attr_reader :size, :original_position, :target_position, :sprite, :current_direction, :distance_to_travel, :start_x, :start_y, :steps, :position_over_time def initialize(sprite, size) @size = size @sprite = sprite ...
true
036a5a9d42714fb88549513e4969652f2ecec088
Ruby
yooonsj/helloworld_ruby
/container&loop/ex04.rb
UTF-8
227
3.25
3
[]
no_license
puts('아이디를 입력하세요.') input_id = gets.chomp() members = ['egoing', 'leezche', 'grapittie'] for member in members do if member == input_id puts('Hello!, ' + member) exit end end puts('Who are you?')
true
11232f586e0b5d64c123f5eaec85d7ef7ded60fd
Ruby
turnon/gzlib
/test/gzlib_test.rb
UTF-8
1,231
2.765625
3
[]
no_license
require 'minitest_helper' require 'gzlib' class TestGzlib < Minitest::Test def test_has_ruby_book score_ruby = Gzlib.search 'ruby', sortWay: 'score' assert_match /^ruby/i, score_ruby.first.title end def test_one_isbn_one_book matz_ruby = Gzlib.search '9787115366467', searchWay: 'isbn' assert_eq...
true
46f83c7134b93a3dcfb229274b2fccbcc51850d4
Ruby
christjin/rate_limiter
/lib/rate_limiter/rule.rb
UTF-8
506
2.578125
3
[ "MIT" ]
permissive
module RateLimiter class Rule attr_reader :name, :limit, :period, :block def initialize(name, options, block) @name, @block = name, block @limit = options[:limit] @period = options[:period] end def cache RateLimiter.cache end def against_by?(request) discrimi...
true
1dca6516869e2f9e9075366689c57abb8c426942
Ruby
tribbyfam/learning-Ruby
/Practice/library_book/code/Ch 7 programs/7-1.rb
UTF-8
1,355
4.15625
4
[]
no_license
#!/usr/bin/ruby # 35 students in our class NUM_STUDENTS = 35 # Max grade of 100% MAX_GRADE = 100 num_compare = 0 arr = Array.new(NUM_STUDENTS) # Randomly populate arr for i in 0..(NUM_STUDENTS - 1) # Maximum possible grade is 100%, keep in mind that rand(5) ret...
true
b0d558f8a0f6085c77d8840ad518012e6a0e11fd
Ruby
fhernandez173/keys-of-hash-001
/lib/keys_of_hash.rb
UTF-8
1,101
3.578125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' {"sugar glider"=>"Australia", "aye-aye"=>"Madagascar", "red-footed tortoise"=>"Panama", "kangaroo"=>"Australia", "tomato frog"=>"Madagascar", "koala"=>"Australia"} # class Hash # def keys_of(*arguments) # animal_array = [] # self.collect do |animal, habitat| # # puts "#{habitat} : #...
true
af870857594cada44e28eb6fe64dce29df11ec2e
Ruby
paulo-silva/conta_azul_api
/lib/conta_azul_api/product.rb
UTF-8
966
2.546875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'ostruct' require 'conta_azul_api/models' module ContaAzulApi class Product < ::ContaAzulApi::Models class NotFound < StandardError; end PRODUCT_ENDPOINT = 'v1/products' MAX_PRODUCTS_PER_PAGE = 1000 def self.find(product_id) product_response = ContaAzulAp...
true
b14aa98ec446e238b56190c5a94f44b88ffe1f89
Ruby
chet-k/DSA-Problems
/cookie_distribution.rb
UTF-8
300
2.96875
3
[]
no_license
def find_content_children(g, s) cookies_handed_out = 0 g.sort! s.sort! gi = g.length - 1 s.reverse.each do |cookie| gi -= 1 until gi < 0 || g[gi] <= cookie break if gi < 0 cookies_handed_out += 1 gi -= 1 end cookies_handed_out end
true
4e5f78f23269f47ddebe9d75a2eb2f26854fc2d3
Ruby
pvhungpd01220/RubyLearn
/rubyTraining/ex2_array.rb
UTF-8
1,114
3.546875
4
[]
no_license
array = [1, 2, 3, 4, 5, 6, 7, 8, 9] #dem so chia het cho 4 biendem = 0 array.each do |item| if item % 4 == 0 biendem = biendem + end end p biendem #e #ex 3 tính tổng của 4 phần tử đầu của array arr = array[0..3] p arr.sum #ex 4 Tính tổng của phần tử đầu và phần tử cuối sau đó thêm vào đầu array array = [1,...
true
7598bc18f6a99f58d9c7b44dd380ac284abe4a3e
Ruby
michaelciletti/minedmindskata
/test_mm.kata.arrays.rb
UTF-8
247
2.578125
3
[]
no_license
require "minitest/autorun" require_relative "mm.kata.arrays.rb" class TestMinedMindsKata < Minitest::Test def test_1_returns_1 assert_equal(1,1) end def test_1_array_length results = minedmindskata() assert_equal(100,results.count) end end
true
383349fb93ac613d76b2e7822929184d50944a72
Ruby
tvw/simple_sheets
/lib/simple_sheets/data.rb
UTF-8
296
2.828125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module SimpleSheets class Data def initialize(fh, content = nil) @content = content fh.puts "<Data#{type}>#{@content}</Data>" end def type return ' ss:Type="Number"' if @content.is_a?(Fixnum) or @content.is_a?(Float) ' ss:Type="String"' end end end
true
6f773cb622bfa80d64f969832a2d549170652d57
Ruby
brightshiny/whiskey
/app/models/item_for_display.rb
UTF-8
965
2.71875
3
[]
no_license
class ItemForDisplay < ActiveRecord::BaseWithoutTable attr_accessor :id, :title, :description, :link, :author, :feed_name, :feed_link, :published_at def initialize(item) @id = KEY.url_safe_encrypt64(item.id) @title = item.title @description = ItemForDisplay.clean(item.content) @link = item.lin...
true
45f0a2acd1974d52754ab3e887701178df91aeba
Ruby
dball1126/Coding_problems
/ruby/is_same_tree.rb
UTF-8
876
3.625
4
[]
no_license
def is_same_tree(p, q) queue = [p, q] while queue.length > 0 t1 = queue.shift t2 = queue.shift return false if t1.val != t2.val return false if !t1.left.nil? && t2.left.nil? return false if t1.left.nil? && !t2.left.nil? return false if !t1.right.nil? && t2.ri...
true
775e5e026ff4597a5380ba9db7d9b6cee05ab91b
Ruby
asceth/bbcoder
/lib/bbcoder/configuration.rb
UTF-8
400
2.578125
3
[ "MIT" ]
permissive
class BBCoder class Configuration attr_accessor :tags def initialize @tags = {} end def [](value) @tags[value] end def clear @tags = {} end def remove name @tags.delete(name.to_sym) end def tag(name, options = {}, &block) @tags[name.to_sym] = ...
true
98b94ed73ab5da6983413a8fed5b2b25162434f5
Ruby
tflecht/calendarized_reports
/lib/end_of_days.rb
UTF-8
436
2.921875
3
[]
no_license
require 'singleton' require 'reporting/date_extreme' module Reporting # EndOfDays is a fake datestamp that occurs _after_ all other date values. class EndOfDays < DateExtreme include Comparable include Singleton ## # The EndOfDays always comes after +other+! def <=>(other) 1 end ...
true
b9ab03d0f9258eaaae68420f1297e70cb404b8ad
Ruby
ambtus/mobile-pages
/app/models/filter.rb
UTF-8
5,545
2.546875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Filter LIMIT = 5 # number of pages to show in index def self.tag(name, start) Rails.logger.debug "Filter.tag(#{name}, #{start})" tag = Tag.find_by_name(name) tag = Tag.find_by_short_name(name) unless tag tag.pages.order('read_after ASC').limit(start + LIMIT)[start..-1] end def self.new(...
true