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
0bae32b32291450374acabbbe44aa1189b55c9c4
Ruby
mabako/orange-pie
/features/step_definitions/user_steps.rb
UTF-8
2,899
2.703125
3
[]
no_license
def create_visitor @visitor ||= { :name => 'joe', :email => 'joe@example.org', :password => 'hello world!', :password_confirmation => 'hello world!' } end def find_user @user ||= User.where(:email => @visitor[:email]).first end def create_user create_visitor @user = FactoryGirl.create(:user, @visitor) end de...
true
8a24a3feaaed5e40a1fa6503a5975b3ea02ad762
Ruby
jrmhaig/AdventOfCode
/2021/05/lib/factories/two.rb
UTF-8
323
2.84375
3
[ "Beerware", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'factories/base' require 'vents/vertical' require 'vents/horizontal' require 'vents/diagonal' module Factories class Two < Base private def klass(pos1, pos2) return Vents::Vertical if pos1[0] == pos2[0] return Vents::Horizontal if pos1[1] == pos2[1] Vents::Diagonal end end e...
true
dbf649908b822a6348c36b10cb4c1fe20dbd33ec
Ruby
neenjaw/my-exercism-ruby-exercises
/sum-of-multiples/sum_of_multiples.rb
UTF-8
415
3.453125
3
[]
no_license
require 'set' class SumOfMultiples attr_reader :factors def initialize(*factors) @factors = factors end def to(limit) multiples = factors.inject(Set.new) do |set, factor| set | generate_multiples(factor, limit) end multiples.to_a.sum end private def generate_multiples(...
true
abc6d80e8008506b46c7f5d21d44a9dd389b07be
Ruby
NeverBounce/NeverBounceCli-Ruby
/lib/never_bounce/cli/feature/envars/examples_mapper.rb
UTF-8
1,055
2.9375
3
[ "MIT" ]
permissive
require_relative "../envars" module NeverBounce; module CLI; module Feature; module Envars # A simple transformer/validator for <tt>examples</tt> argument. # # @see #process class ExamplesMapper # Process input, render output. # # process([1, 2, 3]) # => {values: [1, 2, 3]} # pr...
true
3258aa918d613fd04168f4417032765755bc13ba
Ruby
mo-ta/tools
/test.rb
UTF-8
2,315
2.671875
3
[]
no_license
require "open3" require 'io/console' $ale_com = "" $ale_com << '/home/motoki/work/DQN/Arcade-Learning-Environment-0.5.1/ale' #$ale_com << ' -run_length_encoding false' $ale_com << ' -game_controller fifo' $ale_com << ' -display_screen true' #$ale_com << ' -random_seeds 0' #$ale_com << ' -frame_skip 4' $ale_com << ' g...
true
406380a781c1eb38fd03846f728909fc2cd24404
Ruby
yadukrishnan88/basic_ruby_programs
/Strings/Task35.rb
UTF-8
242
3.421875
3
[]
no_license
=begin Display each charactes in a string separatly hello should be displayed as h e l l o =end class Task35 def disp(str) puts str i=0 while i < (str.length()) puts str[i] i=i+1 end end obj=Task35.new obj.disp("Ruby") end
true
86ee4be38353946066f72d46018b696dcdbd5b28
Ruby
hougland/cs-fundamentals
/sorting/mergesort.rb
UTF-8
1,591
4.15625
4
[]
no_license
def mergesort(a) # if the array size is 0|1 then the list is considered sorted, return sorted array return a if a.length <= 1 # split the list in half left, right = split_array(a) # merge sort each half left = mergesort(left) right = mergesort(right) # combine the sorted halves return combine(left, right) end ...
true
4955897205d2058dbd82d4aeb2e2899c1655b711
Ruby
hzhangse/multicluster-demo
/tmp/debug/app.rb
UTF-8
1,030
2.78125
3
[]
no_license
require 'sinatra' require 'net/http' $stdout.sync = true service = ENV['SERVICE'] destinations = ENV['DESTINATIONS'] def start_service service puts "starting service #{service}" set :bind, '0.0.0.0' set :port, 7000 get "/#{service}" do content_type :text puts "receiving call from #{request.ip}" "...
true
cb8ed124651ac6c129a646c71dd36644ce81ac3b
Ruby
rails/rails
/activesupport/lib/active_support/core_ext/object/blank.rb
UTF-8
2,990
3.421875
3
[ "MIT", "Ruby" ]
permissive
# frozen_string_literal: true require "concurrent/map" class Object # An object is blank if it's false, empty, or a whitespace string. # For example, +nil+, '', ' ', [], {}, and +false+ are all blank. # # This simplifies # # !address || address.empty? # # to # # address.blank? # # @retur...
true
f3ba33fb7da407df8e8a98fc4d359a8e3542cc12
Ruby
dqmrf/dive-in-ruby
/tasks/reduce_string.rb
UTF-8
369
2.875
3
[]
no_license
def reduce_string(str, length) reduced_str = str[0..length.to_i] index = reduced_str.rindex(/\s/) if length - index < 30 && index != length reduced_str = reduced_str[0...index] end reduced_str.rstrip + '...' end str = 'Fact Sheet #35 - CollectibilityofMajapitalImprovementand/orOwnerInd (OI) Rent Increa...
true
61bb0e1082c69261c30fa03ac0acd0374fd143f2
Ruby
jbyrnesshay/chrispine_ruby
/ch2/things_to_try.rb
UTF-8
575
4.15625
4
[]
no_license
#how many hours in a year def hours_in_year _hours_in_year = (24*7) * 52 end puts hours_in_year #minutes in a decade def mins_in_decade _mins = (60 * 24) * 365 * 10 end puts mins_in_decade #my_age_in_seconds #if I were born in 1900 time_now = Time.new puts time_now time_at_birth = Time.new(1900,4,10, 2, 30,...
true
6dc272327cec2048e79793f73a631e1537b7a0e1
Ruby
A-Jhee/Intro-to-Ruby-exercises
/hashes/exer3.rb
UTF-8
239
3.28125
3
[]
no_license
family = { sister: "jane", brother: "frank", uncle: "bob", aunt: "mary" } family.each_key { |k| puts k } family.each_value { |v| puts v } family.each_pair { |k, v| puts "#{k} is #{v}"}
true
c640a94a6969c9654460e143a58a522ab0eb5e6a
Ruby
Itsnothisfsult/170
/Interests/interests.rb
UTF-8
968
2.546875
3
[]
no_license
require 'sinatra' require 'sinatra/reloader' require 'tilt/erubis' require 'yaml' LIST_OF_NAMES = 'public/users.yaml' before do @info = YAML.load_file LIST_OF_NAMES end get '/' do redirect '/names' end get '/names' do @title = 'All Names' erb :names end get '/user' do @name = params['name'] @title = "...
true
6a4c8256b3ba06e53c0a928e36d6d087bc6b208f
Ruby
RowanDW/ruby-exercises
/mythical-creatures/lib/wizard.rb
UTF-8
359
3.40625
3
[ "MIT" ]
permissive
class Wizard attr_reader :name, :bearded def initialize(name, bearded = true) @name = name @bearded = bearded @spells_cast = 0 end def bearded? @bearded end def incantation(spell) return 'sudo ' + spell end def cast @spells_cast += 1 return "MAGIC MISSILE!" end def r...
true
a2e36e474acb98ea1dacabd5030000bb09073580
Ruby
jackwillis/hir
/lib/hir.rb
UTF-8
2,258
2.6875
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
class Hash def to_html_attrs map { |k, v| " #{k}='#{v}'" }.join end end class HIR VERSION = "1.1.0" module Tags def self.add_tag(tagname) define_method(tagname) { |*args, &block| tag(tagname, *args, &block) } define_method("#{tagname}!") { |*args, &block| tag_sc(tagname, *args) } end...
true
312200dfc399b7b40f789cafdc6933ccb300819f
Ruby
zeteticl/udonarium
/src/src_bcdice/utils/d66_range_table.rb
UTF-8
590
3.328125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # 項目をRangeを用いて参照するD66表 class D66RangeTable # @param name [String] 表の名前 # @param items [Array<(Range, String)>] 表の項目の配列 def initialize(name, items) @name = name @items = items.freeze end # 表を振る # @param bcdice [BCDice] ランダマイザ # @return [String] 結果 def roll(bcdice) di...
true
5eb3a040d547cc0d52953b7be7851660ae5ac5d2
Ruby
tunnes/learn-ruby
/02_ruby_extra/guess_a_number/app.rb
UTF-8
179
3.203125
3
[]
no_license
require_relative 'lib/guess_number' an_game = GuessNumber.new until an_game.winner print "Guess an number: " hunch = gets.chomp puts an_game.tryNumber(hunch.to_i) end
true
bfae621f06f678c59a89fe84983d69f0e81e9e2c
Ruby
Soufianeterhzaz/sylrplm
/app/models/favori_item.rb
UTF-8
129
2.578125
3
[]
no_license
class FavoriItem attr_reader :object def initialize(obj) @object = obj end def title @object.title end end
true
a156dd3bb50a5bb3ea3f7a63cb2af4418a11305e
Ruby
dan3lson/time-trckr
/app/models/tag.rb
UTF-8
850
2.8125
3
[]
no_license
class Tag < ApplicationRecord # Associations belongs_to :user has_many :logs_tags, dependent: :destroy has_many :logs, through: :logs_tags # Validations validates :name, presence: true # Scopes scope :by_name, -> { order(:name) } # == Initializer # # Build new tag objects from # the ...
true
d0f2e05cc001b9bcfaae8f75863ce697a3f783c6
Ruby
chuckwagoncomputing/foac
/strategies/enemyFromCouch.rb
UTF-8
1,392
3.109375
3
[]
no_license
# Keep track of who has three pseudonyms class StrategyenemyFromCouch def initialize(parent) @strategy = parent @player = @strategy.player @memory = @strategy.memory end def remember(calledName, calledTeam, calledPosition, calledPseudonym, callerName) # if someone called a number being remembered if @memo...
true
eb1fc0491396934e6998bc35a0bbc08751588cd3
Ruby
MinasMazar/ametista
/lib/ametista/strings.rb
UTF-8
441
2.9375
3
[ "MIT" ]
permissive
module Ametista class ::String LAMERIZE = { 'a' => '4', 'e' => '3', 'i' => '1', 'o' => '0', 't' => '7', 'b' => '8', 'g' => '9', 's' => '5' } def fs_normalize downcase.gsub(' ', '_') end def lamerize LAMERIZE.inject(self) {|l_s, h| l_s.gs...
true
ac6c1659c130178f11d9dd19f9a08acc230cdf78
Ruby
jgarber/redcloth-treetop
/spec/redcloth/parser/list_parser_spec.rb
UTF-8
4,603
2.640625
3
[ "MIT" ]
permissive
require File.dirname(__FILE__) + "/../../spec_helper" require 'redcloth/parser/list' module RedCloth module Parser describe ListParser do before :each do @parser = ListParser.new end def parse(string) @parser.parse_or_fail(string) end it "should parse a...
true
913901371d8b109d902bd217af465a254dbdebdf
Ruby
Homies886/deli-counter-online-web-pt-031119
/deli_counter.rb
UTF-8
623
3.421875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
katz_deli = [] def line(queue) if queue.length <= 0 puts "The line is currently empty." else current_line = "The line is currently:" queue.each.with_index(1) do |person, i| current_line << " #{i}. #{person}" end puts current_line end end def take_a_number(number_in_line, name) number_...
true
816ad85ed2fcf89a233b8dbb433f4a7484ea9e08
Ruby
ga-wdi-boston/wdi_2_ruby_demo_modules
/lib/animal.rb
UTF-8
715
4.34375
4
[]
no_license
# All Animals have a name and can move, unlike Plants # Dogs can do much, other than move. # People can talk. # Parrots can talk and fly. # Bats can fly. # Root of hierarchy # Whats the root of all Ruby Objects? class Animal attr_accessor :name def initialize(name) @name = name end def move "The #{s...
true
294fe2461f4e1bbbfad47a425759001f391bf71c
Ruby
red-n-black-tree/Breath-OS
/etc/skel/.wine/drive_c/Program Files (x86)/Google/Google SketchUp 8/Plugins/Examples/animation.rb
UTF-8
3,365
2.984375
3
[]
no_license
# Copyright 2012, Trimble Navigation Limited # This software is provided as an example of using the Ruby interface # to SketchUp. # Permission to use, copy, modify, and distribute this software for # any purpose and without fee is hereby granted, provided that the above # copyright notice appear in all copies. # TH...
true
ec199a331e81f97b0ab64dae4747b6e12c98782a
Ruby
edsant1/stalgo
/lib/list_info/code_counter.rb
UTF-8
748
2.59375
3
[ "MIT" ]
permissive
module ListInfo module CodeCounter #Count the lines of Ruby code in your app COUNTER = "find . -iname '*.rb' -type f -exec cat {} \\; | wc -l" HAS_MANY_SEARCH = "ack \" has_many \" -c | awk -F \":\" '{print $2,$1}' | grep -v \"0\" | sort -rn" LOC = "find . -iname '*.rb' -type f -exec wc -l {} \\; | sort -r...
true
9c0e8a5ab5a57d9bfa80efb5de7a2b24df72be08
Ruby
outragedpinkracoon/advent_of_code_2020
/day_1/part_2.rb
UTF-8
257
3.0625
3
[]
no_license
# frozen_string_literal: true # Advent of code day 1 part 2 https://adventofcode.com/2020/day/1#part2 module Part2 def self.run(input) input.combination(3).each do |items| return items.reduce(&:*) if items.reduce(&:+) == 2020 end end end
true
9facd46ab548119c56d652f54c9948f27d598aa7
Ruby
johnsendaniel8974/yotme-api_lastest_version
/app/services/bulk_builder/endorsements.rb
UTF-8
1,097
2.859375
3
[]
no_license
module BulkBuilder class Endorsements attr_reader :collection, :endorser_id, :endorsements def initialize(collection, endorser_id) @collection = collection @endorser_id = endorser_id @endorsements = [] end def call all_valid = true collection.each do |tuple| en...
true
c1f3e6b70a8f45b952af6b38b73ee2c698e7dad8
Ruby
frankwarren21/ttt-6-position-taken-rb-ruby-intro-000
/lib/position_taken.rb
UTF-8
254
3.09375
3
[]
no_license
board = [" "," "," "," "," "," "," "," "," "] index = 0 def position_taken?(board,index) if board[index] == " "||board[index] == ""||board[index]== nil return false end if board[index] == "X"||board[index] == "O" return true end end
true
f01212359bba4fdaef67f23fb4db7fb539e51ad3
Ruby
dylanegan/stew
/lib/stew/server.rb
UTF-8
1,681
2.703125
3
[ "MIT" ]
permissive
module Stew class Server attr_reader :exchanges, :logger, :queues def initialize(options = {}, &block) @exchanges = { :direct => {}, :fanout => {}, :topic => {} } @options = options @queues = {} initialize_logger yield(self) if block_given? end def initialize_logger ...
true
39e9e7208a044e8b71fe2452f7f984ffa7487412
Ruby
aaroncallagher/intro_to_programming
/ch_the-basics/exercise1.rb
UTF-8
79
2.9375
3
[]
no_license
first_name = 'Aaron' last_name = 'Callagher' puts "#{first_name} #{last_name}"
true
961c84c34e64c9b5b9adf8e4e9c55ab17d3218de
Ruby
melpp/LearningRuby
/AccessContol.rb
UTF-8
1,735
4.3125
4
[]
no_license
# When designing a class, it is important to think hpw much of it we will be exposing tot he world #Encapsulation: try to hide the internal represantation of the object so you can change it later # Three levels: public, protective andprivate # public methods: no access control is enforced. Anybody can call this class...
true
173edb20d0b09fb489f54e6c83341d7ec373c735
Ruby
carnivore-rb/carnivore-files
/lib/carnivore-files/util/fetcher.rb
UTF-8
2,697
2.703125
3
[ "Apache-2.0" ]
permissive
require 'carnivore-files' module Carnivore module Files # Helper utilities module Util # Fetch lines from file class Fetcher autoload :Poll, 'carnivore-files/util/poll' autoload :Penguin, 'carnivore-files/util/penguin' include Zoidberg::SoftShell include Zoidberg...
true
20d1329eeffff6feae42b3c45ea8fe728f3205bd
Ruby
sosflyyi/laboratory
/ShellScript/Test/RubyScript.rb
UTF-8
1,033
2.921875
3
[]
no_license
# Makefile の一部を書き換え、 # C++ のインラインコードをコンパイルできるようにする ########################################################### # require ########################################################### require "logger" # log 出力用 ########################################################### # global object ##########################...
true
c3b268ac63b11900c63ddcd0835ee9ad9dafb510
Ruby
spencerkevans/prime-ruby-v-000
/prime.rb
UTF-8
361
3.46875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def prime?(n) # first, check for n = 1 return false if n < 2 # none? Passes each element of the collection # to the given block. The method returns # true if the block never returns true for # all elements. If the block is not given, # none? will return true only if none of the # collection members is tru...
true
6cec0322a1551d1439596d7316c3bc85399e3200
Ruby
LukeChen2010/sinatra-mvc-lab-onl01-seng-ft-050420
/models/piglatinizer.rb
UTF-8
415
3.5
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class PigLatinizer def initialize end def piglatinize(phrase) words = phrase.split(" ") output = [] words.each do |x| if x.start_with?(/[aeiouAEIOU]/) output << (x << "way") else until x.start_with?(/[aeiouAEIOU]/) x = x[1, x.length - 1] << x[0] ...
true
31f2caf3f843242752152de9668cb8c9483b015b
Ruby
pelf/advent-of-code-2019
/day22/day22_part1.rb
UTF-8
670
3.65625
4
[]
no_license
def deal_into_new_stack(deck) deck.reverse end def cut(deck, n) deck[n..-1] + deck[0...n] end def deal_with_increment(deck, n) new_deck = Array.new(DECK_SIZE) DECK_SIZE.times do |i| new_deck[(i*n)%DECK_SIZE] = deck[i] end new_deck end shuffles = File.readlines("input.txt") DECK_SIZE = 10_007 deck =...
true
41a2d8b5d9be755016ba3c595424fcb8d4d2c64f
Ruby
88miles/gigawatt
/lib/gigawatt/commands/setup.rb
UTF-8
3,514
2.703125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Gigawatt module Commands class Setup attr_accessor :options def self.run!(settings) options = Trollop::options do banner <<-EOS 88 Miles Command line application - http://88miles.net This command will request an access token, giving the command line utility access to your 88...
true
06558cca17438a40a0214ce067235558444982df
Ruby
christianguenter3/xml_formatter
/xml_formatter.rb
UTF-8
1,447
2.8125
3
[]
no_license
require 'HTTPClient' require 'htmlentities' require 'clipboard' class XMLFormatter NEW_FILE_NAME = Random.new_seed.to_s TEMPLATE_STRING = '<x>DUMMY</x>' def initialize @http = HTTPClient.new end def format(input_string) File.open(NEW_FILE_NAME,'w+') do |new_file| File.open('Template').each_line do |lin...
true
c46c130b1c9a2be55799d260088a34f1589275fb
Ruby
bhartiRA/oxford-comma-v-000
/lib/oxford_comma.rb
UTF-8
624
3.71875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def oxford_comma(array) if array.length==1 newstring=array.join() puts newstring return newstring elsif array.length==2 newstring=array.join(" and ") puts newstring return newstring else string=array.join(", ") n=string.rindex(',') partone_string = string.slice(0,n+1) parttwo_string = string.slice(n+1,...
true
612cd1a0d830c1a589430a386ae7ef5c0b09ac0a
Ruby
ceciliassis/graduate_ufu
/a*-ia/extend_object_class.rb
UTF-8
239
2.890625
3
[ "MIT" ]
permissive
# Extends the Integer class class Object # Defines a method that produces a shallow copy of itself # # @return [Object] the shallow copy of the object calling the method def deep_copy Marshal.load(Marshal.dump(self)) end end
true
70bdd4873e4365d93d6da4995c5fcde04fdcd5a8
Ruby
shtakai/cd_ruby_fundamentals_puzzle
/puzzles.rb
UTF-8
1,239
3.84375
4
[]
no_license
require 'pp' sample_array = [3,5,1,2,7,9,8,13,25,32] pp 'sample_array' pp sample_array pp 'print the sum of all numbers in the array' pp sample_array.reduce(0){|sum, i| sum += i} pp 'returns an array only include numbers that are gt 10' def arr_include_gt_10(arr) arr.reject{|i| i <= 10} end pp arr_include_gt_10(sam...
true
71933af1295a86fc5c8dfe1686290d39682a38e0
Ruby
masakazu-ishihata/simpath
/simpath.rb
UTF-8
7,092
3.3125
3
[]
no_license
#!/usr/bin/env ruby ################################################################################ # default ################################################################################ @n = 3 ################################################################################ # Arguments ##########################...
true
f8ec6f462fd357c0148891d7963ea5c2520913e0
Ruby
RNtaate/tic-tac-toe
/lib/board.rb
UTF-8
1,086
3.6875
4
[]
no_license
class Board def initialize; end def print_board(moves_array = nil) array = [1, 2, 3, 4, 5, 6, 7, 8, 9] unless moves_array.nil? i = 0 while i < moves_array.length update_board(array, moves_array[i], i) if array.include? moves_array[i] i += 1 end end borad_ui(array)...
true
a3d64cc3d1bea4a521797edff435ae4c9cf741a7
Ruby
Juel07/codewars
/ruby/8kyu/quarter_of_the_year.rb
UTF-8
363
4.09375
4
[]
no_license
# https://www.codewars.com/kata/5ce9c1000bab0b001134f5af/ruby # 3 => 1 # 7 => 3 # 5 => 2 def quarter_of(month) (4 * month / 12.to_f).ceil end ## Alternate solutions from codewars # 1 def quarter_of(month) (month / 3.0).ceil end # 2 def quarter_of(month) (month + 2) / 3 end #3 def quarter_of(month) [0, 1, 1...
true
71cb9307c39bb86077552050bcf6ed210c9e2c95
Ruby
arvida/ya_feedr
/lib/ya_feedr/config/feeds.rb
UTF-8
245
2.59375
3
[]
no_license
module YaFeedr class Feeds include Enumerable def initialize @feeds = [] end def add(parser, settings) @feeds.push({ parser => settings }) end def each @feeds.each {|f| yield(f) } end end end
true
cf6128c764c5044d611bf6a386286f49b4a5ae65
Ruby
Yahjairav23/ruby-enumerables-generalized-map-and-reduce-lab-dc-web-030920
/lib/my_code.rb
UTF-8
427
3.671875
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# Your Code Here def map(source_array) values = [] i = 0 while i < source_array.length values.push(yield(source_array[i])) i += 1 end return values end def reduce(source_array, starting_value = nil) if starting_value sum = starting_value i = 0 else sum = source_array[0] i = 1 ...
true
93d3389a4fb0a9a57ba3ac5129b454e2e62a3a35
Ruby
MatthewBurstein/sinatra_hello_world
/main.rb
UTF-8
314
2.515625
3
[]
no_license
require 'sinatra' require 'slim' require_relative 'classes/fizzbuzz' get '/' do slim :index end # get '/:number' do # @output = params[:number] # slim :output # end post '/fizzbuzz' do @output = FizzBuzz.new.translate(params[:number].to_i) slim :output end get '/slideshow' do slim :slideshow end
true
8d69f49fa46428b570615618cb51e9258b6850ac
Ruby
1ncM/ror_beginner_2
/part_6/main.rb
UTF-8
7,920
3.390625
3
[]
no_license
require_relative 'instance_counter.rb' require_relative 'company.rb' require_relative 'route.rb' require_relative 'railway_station.rb' require_relative 'train.rb' require_relative 'cargo_train.rb' require_relative 'passanger_train.rb' require_relative 'wagon.rb' require_relative 'cargo_wagon.rb' require_relative 'passa...
true
6db3cd6cf3a64b67d385e64642e063d470d7984d
Ruby
uddystyle/perfect_ruby_sample
/file_09.rb
UTF-8
120
2.515625
3
[]
no_license
File.open 'fname.txt' do |f| # 任意の位置に移動する f.pos = 30 # 現在の位置を返す p f.pos end
true
81684b0c84d86ade5f3a109ec01e2b076a828c8d
Ruby
brandt2/W3D5
/Building ActiveRecordLite/lib/01_sql_object.rb
UTF-8
1,698
2.96875
3
[]
no_license
require_relative 'db_connection' require 'active_support/inflector' require 'byebug' # NB: the attr_accessor we wrote in phase 0 is NOT used in the rest # of this project. It was only a warm up. class SQLObject def self.columns @list ||= DBConnection.execute2(<<-SQL) SELECT * FROM "#{...
true
e8787952b7fd3f637688f250776c98a3b005c0be
Ruby
sojastar/SFSM
/test/fsm_state_test.rb
UTF-8
2,341
2.796875
3
[ "MIT" ]
permissive
require 'minitest/autorun' require_relative 'test_helper.rb' describe FSM::State do it 'initializes' do state = FSM::State.new(:a_state) { puts "do nothing" } assert_equal :a_state, state.name assert_nil state.setup assert_empty state.events end ...
true
e7d478638bce2af60da7562bf4c7b0dce6b69be2
Ruby
andercol4/lunch_lady
/lunch_lady.rb
UTF-8
2,341
3.78125
4
[]
no_license
require 'pry' class Food attr_accessor :food, :item_number, :price def initialize(item_number, food, price) @item_number = item_number @food = food @price = price end end steak = Food.new(1, "Steak", 5.75) burger = Food.new(2, "Burger", 4.99) chicken = Food.new(3, "Chicken", 3.14) fries = Food.new(1, "Fri...
true
97887b17e23cb17b5196eb685253f4933737653e
Ruby
m-gb/rubytapas
/episode398_string_io.rb
UTF-8
950
2.796875
3
[]
no_license
# The IO class is the basis for all input and output in Ruby. # An IO object is effectively a wrapper around the operating systems concept of a filehandle. # Like the File class, the Socket library subclasses from IO (such as TCPSocket or UDPSocket). open("/dev/urandom") # => #<File:/dev/urandom> File.super...
true
e3cdf111270d629b25395a246d658b43986a3eee
Ruby
nickstoneman/week_5
/calculator/main.rb
UTF-8
1,086
2.84375
3
[]
no_license
require 'sinatra' require 'sinatra/contrib/all' require 'pry' get '/' do erb :home end get '/basic_calc' do @operator = params[:operator] if @operator @first = params[:first].to_f @second = params[:second].to_f @result = case @operator when '+' then @first + @second when '-' then @first...
true
04f9bf648f8382ecbad8aa6e09e153b3da920218
Ruby
lisafolliard/objects_practice
/spec/contact_spec.rb
UTF-8
2,124
2.8125
3
[]
no_license
require('rspec') require('contact.rb') describe(Contact) do before() do Contact.clear() end describe('#last_name') do it('returns the last_name, first_name, job_title, and company') do test_contact = Contact.new({:last_name => "Smith", :first_name => "John"}) expect(test_contact.last_name())...
true
78cbfa9c3a33276882299d4fa669011d01372218
Ruby
shirleytang0121/AAClasswork
/W2D5/FA2_practice/lib/connect_tac_toe.rb
UTF-8
782
3.65625
4
[]
no_license
require_relative 'board' require_relative 'player' class ConnectTacToe def initialize(stacks, max_stack_height) @board=Board.new(stacks,max_stack_height) @player_1=Player.new('y') @player_2=Player.new('b') @current_player=@player_1 end def switch_players! ...
true
31a7a4890a68aa10016900a93e8f499e8f193927
Ruby
piotrmurach/tty-tree
/lib/tty/tree/hash_walker.rb
UTF-8
1,724
2.9375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# frozen_string_literal: true require 'pathname' require_relative 'node' module TTY class Tree # Walk and collect nodes from hash data strcture. # # @api public class HashWalker attr_reader :nodes attr_reader :files_count attr_reader :dirs_count def initialize(options = {...
true
09b8e65f49e3938716f00f1afc879823c12418f8
Ruby
dudepare/RoboMat
/lib/command.rb
UTF-8
1,081
3.09375
3
[ "MIT" ]
permissive
class Command attr_reader :operation, :params def initialize(cmd, params=nil) @operation = cmd @params = params end def to_s result = "Command #{@operation}" if @params result += " with arguments #{@params}" end result end def is_valid?(robot) valid = robot.respond_to?(...
true
3038105e2dca584ffb2258ed72b56286e4e63c97
Ruby
mizoR/Understanding-Computation
/examples/example003.rb
UTF-8
274
3.140625
3
[]
no_license
# ./bin/simple ./examples/example.rb expression = Add.new( Multiply.new(Number.new(1), Number.new(2)), Multiply.new(Number.new(3), Number.new(4)) ) while expression.reducible? p expression p expression.reducible? expression = expression.reduce end p expression
true
75072c014f9e06902fc1414d4d946d9afdd1a81e
Ruby
HellperKK/ruby-midi
/src/Portee.rb
UTF-8
211
3.125
3
[]
no_license
class Portee def initialize @notes = [] end def add(note) @notes << note end def add_line(notes) @notes += notes end def render notes = @notes.map{|e| e.render}.join(" ") end end
true
b4b5b01febf0cc472ee459ce18b6b59eafd007f7
Ruby
bharatagarwal/launch-school
/101_programming_foundations/small_problems/07_easy_7/02.rb
UTF-8
1,037
4.59375
5
[]
no_license
# Write a method that takes a string, and then returns a hash that contains 3 entries: one represents the number of characters in the string that are lowercase letters, one the number of characters that are uppercase letters, and one the number of characters that are neither. ALPHABETS = ('a'..'z').to_a + ('A'..'Z').t...
true
c014feea14ea667c4e9ccc6695854710f4190782
Ruby
adityavs/AdventOfCode2019
/solutions/day17/main.rb
UTF-8
1,770
3.1875
3
[]
no_license
require 'io/console' require_relative '../common/intcode' INST = File.read('data.txt').split(',').map(&:to_i) def get_arr_xy arr, x, y return nil if x < 0 or y < 0 arr.fetch(y, [])[x] end def sum_arr a, b a.zip(b).map{ |s| s.reduce(:+) } end def part1 c = Cpu.new INST c.run lines = c.read_al...
true
b250157b288a8788fb900721fb5e4e85d340dbd5
Ruby
ajlevitz/blogger
/app/models/article.rb
UTF-8
633
2.625
3
[]
no_license
class Article < ActiveRecord::Base has_many :comments has_many :taggings has_many :tags, through: :taggings # removing this so that I can have multiple attachments in its own model # has_attached_file :image has_many :images def tag_list self.tags.collect do |tag| tag.name end.join(", ") end def ...
true
81c26e42202e691bf684fda40aa67a6ab6562dc5
Ruby
ADKebert/tiy-database-with-csv-and-erb
/person.rb
UTF-8
400
2.921875
3
[]
no_license
class Person attr_accessor :name, :phone_number, :address, :position, :salary, :slack_account, :github_account def initialize(name, phone_num, address, position, salary, slack, github) self.name = name self.phone_number = phone_num self.address = address self.position = position self.salary = s...
true
b59946a9d1abffbd642f1c0f02c88ea4d669331a
Ruby
mrowa44/damn-weather
/lib/damn_weather/now.rb
UTF-8
735
2.65625
3
[ "MIT" ]
permissive
module DamnWeather class Now include Weather def weather data = open("http://api.openweathermap.org/data/2.5/weather?lat=#{geo.lat}&lon=#{geo.lng}&units=metric&APPID=#{APP_ID}").read JSON.parse(data) end def id weather['weather'].first['id'] end def temp weather['mai...
true
85e49e876ace27ff089601ef47d785b78e1ff5c8
Ruby
pekorinko/katsulog_tutorial
/review_class.rb
UTF-8
560
3.390625
3
[]
no_license
class Review #口コミの文章部分を @review_text に代入する def initialize(text, count) @text = text @count = count end #@review_text に代入された口コミの文章部分を返す def text @text end def count @count end end content = "良かった" review1 = Review.new(content,1) review2 = Review.new(conte...
true
bda46150f521861ac5a2cba5b8a8bf2971911fd9
Ruby
jamesjoshuahill/boris_bikes
/spec/station_spec.rb
UTF-8
4,129
3.015625
3
[]
no_license
require 'station' describe Station do let(:garage) { double :Garage, receive_broken_bike_report: nil } let(:station) { Station.new(20, 'City Road', garage) } let(:small_station) { Station.new(1, 'Small station', garage) } let(:bike1) { double :Bike, id: '1001' } let(:bike2) { double :Bike, id: '1002' } c...
true
5849184546822c5cb8b0a34cb590e5e57487ff1a
Ruby
rgarner/dos-alerts
/app/models/opportunity.rb
UTF-8
804
2.5625
3
[]
no_license
## # A persistable opportunity that knows when it's published class Opportunity < ActiveRecord::Base self.inheritance_column = :_type_disabled TYPES = [ 'Digital outcomes', 'Digital specialists', 'User research participants' ].freeze validates :type, inclusion: { in: TYPES } def published? ...
true
969c2cd9df036a404747087887e3605b7af71747
Ruby
alexandrus1/pet-detector
/lib/pet-detector/entity_matrix.rb
UTF-8
2,146
3.0625
3
[]
no_license
require 'simple-graph' module PetDetector class EntityMatrix < Matrix def to_distance_map Hash.new { |h, k| h[k] = {} }.tap do |result| graph.vertices.each_pair do |from_entity, from_vertex| graph.vertices.each do |to_entity, to_vertex| next if from_entity == to_entity ...
true
569aa54406601a32b81b58c763e27a3ec946f8ff
Ruby
hakan-ronngren/misc-files
/economy/lib/borsdata-client/country.rb
UTF-8
1,168
2.71875
3
[ "Unlicense" ]
permissive
require 'borsdata-client/util' module Borsdata class Country attr_reader :id, :name @@all = nil @@by_id = nil def self.by_id(id) init # The API returns country ids that are not listed in the country json. # We therefore have to be able to invent...
true
f82ac96ae41a7966c5fd5b1d453c92a222f1e47e
Ruby
ambreenhasan/algorithm_practice
/enums.rb
UTF-8
915
4.1875
4
[]
no_license
#implement your own each, map, and inject, select module CustomEnumerable def map(&block) result = [] each do |element| result << block.call(element) end result end def inject(accumulator, &block) each do |element| accumulator = block.call(accumulator, element) end acc...
true
d5dc7649481704de40b4d7045558ca9826b4c33e
Ruby
darrenyong/aaClasswork
/W2D4/Big O/windowed_range.rb
UTF-8
473
3.734375
4
[]
no_license
# Windowed Range # Phase 1 def wmx(arr, window) cmax_range = 0 arr.each_index do |idx| last_idx = idx+window next if last_idx > arr.length sub_arr = arr[idx...last_idx] diff = sub_arr.max - sub_arr.min cmax_range = diff if diff > cmax_range end cmax_range end # wmx([1, 0, 2, 5, 4, 8], 2)...
true
e576d32ffaa75b029ba5d7b2c9a995ab2e6c4fd9
Ruby
jratanadawong/oop-inheritance
/lib/shop.rb
UTF-8
638
3.671875
4
[]
no_license
class Shop attr_reader :name attr_accessor :inventory, :sales def initialize(name) @name = name raise "name required" if name == nil || name.strip == "" @inventory = [] @sales = [] end def add_to_inventory(item) raise "product required" if item == nil @inventory << item end def sell_item(item) ...
true
229ce829b7a9016b059964c1b69d22ecb297e4b4
Ruby
Seva-Sh/RB101
/codewars/ex1.rb
UTF-8
1,134
4.65625
5
[]
no_license
# In this kata, you've to count lowercase letters in a given # string and return the letter count in a hash with 'letter' # as key and count as 'value'. The key must be 'symbol' instead # of string in Ruby and 'char' instead of string in Crystal. # Example: # letterCount('arithmetics') #=> {:a=>1, :c=>1, :e=>1, :h...
true
ddfcd174baa61cc6fa2d3e578860f1ab6a446dd3
Ruby
colinpetruno/portunus
/lib/portunus/rotators/kek.rb
UTF-8
1,309
2.578125
3
[ "MIT" ]
permissive
module Portunus module Rotators class Kek def self.for(data_encryption_key) new(data_encryption_key).rotate end def initialize(data_encryption_key) @data_encryption_key = data_encryption_key @unencrypted_dek = data_encryption_key.key end def rotate d...
true
f7ed28e7b657409b21c872fb7b91e10ff2167c86
Ruby
avanegasp/MakeitClass
/segundaSemana/lunes/hashes6.rb
UTF-8
3,346
4.25
4
[]
no_license
HASHES Estructura En este ejemplo estamos creando un hash y almacenándolo en la variable persona. Un hash se define utilizando corchetes ({}). Los elementos se separan con coma (,) y las llaves se separan de los valores con hash rocket (=>). nos permite tener una lista llave - valor persona = { "nombre" => "Germán...
true
ce3f50aca036903d28b990fe7b07582e2c957966
Ruby
aftermathew/uwruby-spring-quarter
/apache_log_processor/bin/apache_log_processor.rb
UTF-8
1,847
2.78125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'optparse' require 'apache_log_processor' class ApacheLogProcessorProgram def initialize @alp = ApacheLogProcessor.new "" end def parse_options #define the option parser option_parser = OptionParser.new do |opts| opts.banner = "Usage: apache_log_processor.rb [opti...
true
c68b884dbcb11f2543e5b4644707c818e65303b4
Ruby
jeffostrin/ffxvtrainer
/event_maintenance/test_scoring.rb
UTF-8
772
2.59375
3
[ "MIT" ]
permissive
require 'test/unit' require_relative 'scoring' class TestEventMaintenanceScoring < Test::Unit::TestCase def test_score_recent_hepoch events = [ "e1", "e2" ] days_ago = 1 result = score_hepoch(events, days_ago) expected = { "e1" => 1, "e2" => 1 } assert_equal(expected, result) end def test_sc...
true
7569f703643ee73f213fc4d386c5b307080db827
Ruby
mrarthurwhite/collections_practice-online-web-ft-120919
/collections_practice.rb
UTF-8
2,281
4.28125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def sort_array_asc(a) a.sort # puts " #{a.sort}" end def sort_array_desc(ar) ar.sort! do |a, b| if a == b 0 #If a and b are equal, the block will return 0, and .sort will leave them in their current places. elsif a < b 1 #If a is < than b and belongs after it, the block ...
true
5d8984bff3198a13413bd038c3ba3c0838e1069c
Ruby
kernelsmith/hieroglyphy-ruby
/obfu_ruby.rb
UTF-8
2,302
3.390625
3
[ "MIT" ]
permissive
require 'hieroglyphy' # # print debugging and error messages # def bug(msg) $stderr.puts("[*] #{msg}") end # # print usage # def usage puts "[!] Usage: #{$0} [script <file>| number <number>| string <string>" puts "[!] Examples:" puts "\t script file.js" puts "\t string \"alert('xss')\"" puts "\...
true
100ff8b3b8e78227a2507ba1af5ff2261b7fad41
Ruby
blg002/blog
/app/models/author.rb
UTF-8
914
2.53125
3
[]
no_license
class Author < ActiveRecord::Base validates :name, presence: true validates :email, presence: true validates :user_name, presence: true, uniqueness: true validates :password, presence: true, length: { minimum: 7 } attr_accessible :name, :u...
true
4228ef3d63c892521c8addcbcd7cf0b02dfb216c
Ruby
DanteAlg/uri_judge
/1014/1014.rb
UTF-8
78
2.875
3
[]
no_license
km = gets.chomp.to_i l = gets.chomp.to_f puts "#{sprintf('%.3f', km/l)} km/l"
true
739eb6f6a378d119e49966a47f43316f9874fbfc
Ruby
JCVogelsberg/corner-grocery
/vendor/bundle/ruby/2.1.0/gems/listen-2.7.4/lib/listen/tcp/broadcaster.rb
UTF-8
1,571
2.90625
3
[ "MIT" ]
permissive
require 'celluloid/io' module Listen module TCP class Broadcaster include Celluloid::IO finalizer :finalize attr_reader :server, :sockets # Initializes a Celluloid::IO-powered TCP-broadcaster # # @param [String] host to broadcast on # @param [String] port to broadcast...
true
289cb1d1388799f4f0128fe50d2419dbb538c644
Ruby
jin0902/coderbyte
/coderbyte_Vowel Count .rb
UTF-8
86
2.84375
3
[]
no_license
def VowelCount(str) # code goes here return str.count "aeiouAEIOU" end
true
754daf6459570746d559833d4b0bd0e4a77642f8
Ruby
Tokinh0/Test_TecSinapse
/ruby_version.rb
UTF-8
2,553
3.328125
3
[]
no_license
require 'net/http' require 'net/https' require 'json' require 'date' require 'benchmark' def get_items uri = URI('https://eventsync.portaltecsinapse.com.br/public/recrutamento/input?email=jean-recados@outlook.com') res = Net::HTTP.get_response(uri) items = JSON.parse(res.body, {symbolize_names: true}) items en...
true
4b1844a6c0ca4e90e6d80cd6ba77851a443bb8b8
Ruby
philhartmanonic/MuunRaad
/app/models/muun.rb
UTF-8
1,291
2.65625
3
[]
no_license
class Muun < ApplicationRecord require 'pry' def Muun.moon_for_date(date) date_object = Date.strptime(date, '%m/%d/%Y') moon_data = HTTParty.get("http://api.usno.navy.mil/moon/phase?date=#{(date_object - 30).strftime('%m/%d/%Y')}&nump=4") new_moon_date = Date.parse(moon_data['phasedata'].select{ |x| x['phase'] ...
true
2f87b3e62f559b88864d89440800b485a1c400ad
Ruby
dobrynin/Chess
/pawn.rb
UTF-8
1,643
3.59375
4
[]
no_license
require_relative 'piece' require_relative 'null_piece' class Pawn < Piece def initialize(board, position) super(board, position) @symbol = (@color == :white ? ' ♙ ' : ' ♟ ') end def moves moves = [one_step] moves += two_step moves.select! { |move| valid_step?(move) } moves + side_step e...
true
ad5cf9d913e6a1b637798dc1bdcd289d5a8fcf86
Ruby
lgonzalez2/cartoon-collections-ruby-cartoon-collections-000
/cartoon_collections.rb
UTF-8
756
3.390625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def roll_call_dwarves(dwarf_names) hash = Hash.new dwarf_names.each_with_index { |name, index| hash[name] = index order = index + 1 order.to_s puts "/#{order}. *#{name}/" } hash end def summon_captain_planet(calls) calls.collect do |call| call << "!" call.capitalize! end calls end ...
true
b6491ae851c6f15dc30060d7c7e876acb64e60a6
Ruby
xaviershay/tailor
/lib/tailor/indentation.rb
UTF-8
5,630
2.984375
3
[ "MIT" ]
permissive
require 'tailor/spacing' module Tailor # Provides methods for checking indentation problems in a FileLine. module Indentation include Tailor::Spacing INDENT_SIZE = 2 HARD_TAB_SIZE = 4 INDENT_EXPRESSIONS = [ /^class\b/, /^module\b/, /^def\b/, /(=\s*|^)if\b/, /(=\s*|^...
true
6d673f77db81ecc34844bd159abafcc69ea9ea87
Ruby
ISS-SOA/codepraise-api
/app/domain/models/contributions/entities/root/folder_contributions.rb
UTF-8
1,800
2.703125
3
[]
no_license
# frozen_string_literal: true module CodePraise module Entity # Entity for folder contributions class FolderContributions < SimpleDelegator include Mixins::ContributionsCalculator attr_reader :path, :files def initialize(path:, files:) @path = path @files = files s...
true
e73f670b5701b31c5ed5d0638c2de1959cbd3f36
Ruby
flynnstigator/assignment_rspec_viking
/spec/warmup_spec.rb
UTF-8
1,095
3.296875
3
[]
no_license
# hello worl require_relative '../lib/warmup.rb' describe Warmup do let (:warmup) {Warmup.new} describe 'gets_shout' do it 'upcases strings from gets' do allow(warmup).to receive(:gets).and_return("shout, shout, let it all out") expect(warmup.gets_shout).to eq("SHOUT, SHOUT, LET IT ALL OUT") e...
true
5a03fa2fb2f1df1e8e14b53a2031633bb1f8b2f3
Ruby
kuboj/dimosir
/lib/dimosir/peer.rb
UTF-8
929
2.515625
3
[]
no_license
require "mongo_mapper" require "bson" module Dimosir class Peer include MongoMapper::Document set_collection_name "peers" key :ip, String, :required => true key :port, Integer, :required => true many :tasks, :class_name => "Dimosir::Task" safe timestamps! def self.ne...
true
75ae9686b4c2523d22095023b35e4d4764a2ef9b
Ruby
danielacodes/ruby-exercises
/arrays/a_ex27.rb
UTF-8
455
4.5
4
[]
no_license
# Write a Ruby program to create a new array # using first three elements of an given array of integers. # If the length of the given array is less than three # return the original array. def check_array array = Array.new new_array = Array.new puts "Give me array" array = gets.chomp if (array.length>3) ...
true
a59bba580bce2c2021b508a1af2606969e294a76
Ruby
pavelstross/sdf_bot
/sdf_bot.rb
UTF-8
2,429
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'rubygems' require 'thread' require 'sqlite3' require 'active_record' require 'nokogiri' require 'open-uri' require 'cinch' require 'cinch/commands' ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => ':memory:' ) class ActiveRecord::Base mattr_accessor ...
true
b363f7d195ebd0e36c8abe8c3e7ea4c13a771921
Ruby
Interviewer-IN/Interviewer
/app/controllers/api/v1/users_controller.rb
UTF-8
1,703
2.546875
3
[]
no_license
module Api module V1 class UsersController < ApplicationController def index users = User.order('created_at DESC') render json: {status:"SUCCESS", message: "Users loaded", data:users}, status: :ok end def show user =User.find(params[:id]) render json: {status:"S...
true
33a9751f7d203fd81f2211ea799842ec01f16ea8
Ruby
dragonmaus/home-old-2017-05-21
/src/bin/pbcanon/pbcanon.rb
UTF-8
424
2.796875
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env ruby # frozen_string_literal: true require 'addressable/uri/canon' require 'clipboard' input = Clipboard.paste exit if String(input).empty? input.chomp! puts input exit unless input.include?('.') || input.include?('/') uri = Addressable::URI.parse(input) uri = Addressable::URI.parse("http://#{input...
true
44a0464681cf592f9154907e4a97f76a1315714d
Ruby
Evgeniy-Gorbatsevich/notepad
/post.rb
UTF-8
787
3
3
[]
no_license
class Post def initialize @created_at = Time.now #Дата создания записи @text = nil #Массив строк записи end #запрашиваются записи пользователя def read_from_console #todo end # Этот метод возвращает состояние объекта в виде массива строк, готовых к записи в файл def to_strings #todo end ...
true
d39ebde23a8b3f1668f2384e306cf445425259a6
Ruby
lindellcarternyc/Launch-School----Intro-to-Programming
/loops_iterators/exercises.rb
UTF-8
649
4.46875
4
[]
no_license
# Exercise 1 # The each loop returns the original array on which it was called. # Exercise 2 # Write a while loop that takes input from the user, performs an action, and # only stops when the user types "STOP". Each loop can get info from the user. resp = "" while resp != "STOP" puts "Enter a string to get it's leng...
true
a652b18b16a08a19561606f5505a1b5a3573da56
Ruby
ape-box/crawler
/src/crawlers/website_crawler.rb
UTF-8
3,268
2.875
3
[]
no_license
require 'uri' class WebsiteCrawler attr_reader :url, :spider_factory, :pages, :links_toparse, :links_parsed, :download_service def initialize(url, spiderfactory=nil, downloader=nil) @url = url @originalhost = URI(@url).host reset_state unless spiderfactory.nil? || !spiderfactory.class.method_defi...
true