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
4d7e6391807de8e358e804805cf0a59a5800b7e1
Ruby
mwlang/kucoin-api
/spec/support/mock_websocket_server.rb
UTF-8
2,825
2.609375
3
[ "MIT" ]
permissive
class MockWebsocketServer HOST = '0.0.0.0' PORT = 0 attr_accessor :connections, :response_message def initialize @connections = [] @response_message = {} end def _endpoint port, host = Socket.unpack_sockaddr_in( EM.get_sockname( @signature )) "wss://#{host}:#{port}/endpoint"...
true
53a5b6e484eeec336915135f13b151e21967c954
Ruby
botanicus/cart
/spec/cart/logger_stub_spec.rb
UTF-8
560
2.6875
3
[ "MIT" ]
permissive
require File.join(File.dirname(__FILE__), '..', "spec_helper") require "cart/logger_stub" describe LoggerStub do it "should works with lambdas" do # just return the message proc = lambda { |message| message } logger = LoggerStub.new(proc) logger.debug("Hey, it works!").should eql("Hey, it works!") ...
true
28a37dd4be2761875053266647ebc050ef781985
Ruby
mikeyhogarth/proplog
/spec/expressions/nonterminal_expressions/implication_spec.rb
UTF-8
615
2.765625
3
[ "MIT" ]
permissive
require "spec_helper" module Proplog describe Expression::Implication do subject { Expression::Implication.new("left", "right") } describe "#to_s" do it "returns the conjunction in string form" do expect(subject.to_s).to eq "left → right" end end describe "#premise" do ...
true
f189f1a2a0b835c59c3b43a59e3f45be9f705800
Ruby
PavloKuts/learn_ruby
/flat_search/bin/fs
UTF-8
2,559
2.78125
3
[]
no_license
#! /usr/bin/env ruby require 'logger' require 'docopt' require 'ruby-progressbar' require_relative '../lib/flat_search' require_relative '../lib/file_generator_factory' require_relative '../lib/http_client' require_relative '../lib/cache/sqlite_cache' require_relative '../lib/ad_crawler' class FlatSearchApp DOC = '...
true
feeb0c6099746a3f77bb2f4c7fded068d8bca5bc
Ruby
MetaArchive/educopia
/pln_admin/conspectus/ruby/app/models/content_provider_status_item.rb
UTF-8
1,189
2.53125
3
[]
no_license
class ContentProviderStatusItem < ActiveRecord::Base belongs_to :content_provider; validates_presence_of :content_provider_id; validates_presence_of :cache; validates_presence_of :size; # return size in MB def size_mb() return size / 1048576 #(1024 * 1024) end # update preservati...
true
fcd13dbdbcef1a5d34ef20671d772f29dd7cc922
Ruby
popmedic/roku-buildbifs
/lib/poplib/IMDB.rb
UTF-8
9,435
2.71875
3
[]
no_license
require 'uri' require 'net/http' module Poplib module IMDB # define our constants $imdb_url = "http://www.imdb.com/" $ask_uri_fmt = $imdb_url + "find?q=%s&s=tt" # url for the imdb search $ask2_uri_fmt = $imdb_url + "search/title?title=%s" $title_uri_fmt = $imdb_url + "title/tt%s/" $block_rege...
true
c587b249fbb437e109fc5af6e2da34567e690aa3
Ruby
mackenzie-km/ruby-collaborating-objects-lab-online-web-sp-000
/lib/song.rb
UTF-8
372
3.21875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_accessor :name, :artist def initialize(name) @name = name end def self.new_by_filename(input) filename = input.split(" - ") found_artist = Artist.find_or_create_by_name(filename[0]) filename[1] = Song.new(filename[1]) filename[1].artist = found_artist found_artist.song...
true
e016d50af1fb6e7a1315baf0cbedd24eeba672fa
Ruby
gustaveH/programming-univbasics-4-intro-to-hashes-lab-atlanta-web-021720
/intro_to_ruby_hashes_lab.rb
UTF-8
420
3.125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def new_hash Hash.new end def my_hash { "name"=> "Gustave", "age" => "29"} end def pioneer {name:"Grace Hopper"} end def id_generator {id:3} end def my_hash_creator(key, value) my_hash_creator = { key => value} return my_hash_creator end def read_from_hash(hash, key) hash[key] end def update_counting_...
true
3dd08c87503fb7db67207398692a15ea83df9891
Ruby
yalazad/ruby_challenges
/if_else.rb
UTF-8
808
3.921875
4
[]
no_license
if 1 + 1 == 2 puts "1 and 1 does indeed equal 2" end puts "\n\nWhat is your name?" my_name = gets.chomp #my_name = 'Yasmin' if (my_name == 'Skillcrush') puts "Hellooooo, Skillcrush!" else puts "Oops, I thought your name was Skillcrush. Sorry about that, #{my_name}!" end puts "\n\nWhat is you favourite colour?" ...
true
2731935548c5bb4a7165d2ed5142dc357577994f
Ruby
xavierserena/ics_bc_s18
/week4/recursion_practice/array_min.rb
UTF-8
240
3.828125
4
[]
no_license
def array_min(array, len) if len == 1 array[0] else last, s_to_last = array.pop, array[len - 2] if last < s_to_last array[len - 2] = last end array_min(array, len - 1) end end puts array_min [1, 2, 3, 4], 4
true
43f37b2577e63d9f1e3c984ae12b43a1fa0549a0
Ruby
jalexy12/new_shack
/ss_new.rb
UTF-8
716
4.21875
4
[]
no_license
class Ingredient attr_accessor :price def initialize(name, price) @name = name @price = price end end # Menu banana = Ingredient.new("Banana", 2) caramel = Ingredient.new("Caramel", 1) berries = Ingredient.new("Berries", 3) class MilkShake def initialize @base_price = 3 @ingredients = [] end def add_i...
true
f6c8824bca54db9eeba3225778764e6c29834521
Ruby
asimy/madeleine-1
/samples/dictionary_server.rb
UTF-8
1,916
2.96875
3
[ "BSD-3-Clause" ]
permissive
# # A dictionary server using Distributed Ruby (DRb). # # All modifications to the dictionary are done as commands, # while read-only queries (i.e 'lookup') are done directly. # # First launch this server in the background, then use # dictionary_client.rb to look up and add items to the # dictionary. # You can kill the...
true
4f178f696165ebef60544af82068e7447ec034df
Ruby
d-theus/homemade
/app/helpers/orders_helper.rb
UTF-8
1,450
2.609375
3
[]
no_license
module OrdersHelper def statuses Order::STATUS_TABLE .keys .select { |k| k.to_s != 'nil' } .map { |st| [ I18n.t("activerecord.values.order.status.#{st}"), st ] } .unshift(['любой', nil]) end def payment_methods Order::PAYMENT_METHODS .map { |pm| [ I18n.t("activerecord.values.order.pay...
true
92ddf9cdbc9b22b7a5047cd60074be40686a8ef4
Ruby
marofa/ruby-skillcrush-challenges
/fizzbuzz.rb
UTF-8
160
3.234375
3
[]
no_license
i = 0 while i < 101 if i%3 ==0 && i%5==0 puts "FizzBuzz" elsif i%3 == 0 puts "Fizz" elsif i%5 == 0 puts "Buzz" else puts i end i+=1 end
true
2b5c6ef5311eeb9a515a1def3d3eb48d995a14b8
Ruby
nemrow/fvc_server
/app/models/event.rb
UTF-8
946
2.6875
3
[]
no_license
class Event < ActiveRecord::Base attr_accessible :min_time, :max_time, :duration, :day_index, :description, :title, :all_fvc, :extra_cost, :reg_required before_save :create_max_time def create_max_time duration_in_seconds = self.duration.hour.hours + self.duration.min.minutes self.max_time = self.min_ti...
true
fdcf338e97cdb5a0ba96e8a08443cdf6916645b8
Ruby
ericgj/trackd
/lib/core_ext/struct.rb
UTF-8
244
2.671875
3
[ "MIT" ]
permissive
require 'json/pure' class Struct def to_h self.members.inject({}) do |memo, m| memo[m.to_sym] = self[m.to_sym]; memo end end # for json-encoding without class name def to_json(*a) self.to_h.to_json(*a) end end
true
570fbd1a439a020d516214a1da08b2b4f0aff97f
Ruby
infectedfate/BlackJack
/dealer.rb
UTF-8
181
2.703125
3
[]
no_license
require_relative 'player' class Dealer < Player def take_card? card_sum < 17 && @hand.cards.size == 2 end def hide_cards @hand.cards.map { '*' }.join(' ') end end
true
9b68dc87a8d296884ba688dece6fda0931514679
Ruby
grosser/language_sniffer
/lib/language_sniffer/language.rb
UTF-8
8,615
3.171875
3
[ "MIT" ]
permissive
require 'yaml' module LanguageSniffer # Language names that are recognizable by GitHub. Defined languages # can be highlighted, searched and listed under the Top Languages page. # # Languages are defined in `lib/language_sniffer/languages.yml`. class Language @languages = [] @overrides = ...
true
26133cf7f0513ecfc4cc76cae13af2a43be4328d
Ruby
salman-karim/inject-challenge
/spec/inject_spec.rb
UTF-8
1,132
3.1875
3
[]
no_license
require 'inject' describe Array do describe 'new_inject_block' do it 'should use first element of array as default argument' do expect([3,4,5].new_inject_block {|a,b| a + b}).to eq 12 end it 'should use first element of array as default argument' do expect([1,2,3].new_inject_block {|a,b| a +...
true
da2bc661913c771b1340681920c4d00306cd46f4
Ruby
tliff/systeminformation
/lib/systeminformation/linux/cpu.rb
UTF-8
1,177
2.578125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module SystemInformation module Linux class CPU def initialize @prev_data = read_data end def utilization new_data = read_data returnhash = {} new_data.keys.each do |key| difference = @prev_data[key].zip(new_data[key]).map{|i| i[1].to_f - i[0].to_...
true
88ebdda06ac0541eabb2ed49b0bb69e8b0682354
Ruby
mfilej/zerop
/lib/episode.rb
UTF-8
551
2.546875
3
[]
no_license
require "forwardable" class Episode class << self extend Forwardable def_delegators :collection, :save, :find, :find_one def collection @collection ||= Zero.db_connection["episodes"].tap do |c| c.create_index([[:pubdate, -1]]) end end KEY = "_id" def [](id) find_...
true
6f5f2666297b79a8c1e8299e166178b07351b0a5
Ruby
cba1067950/sql-library-lab-dumbo-web-051319
/lib/querying.rb
UTF-8
1,301
2.6875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def select_books_titles_and_years_in_first_series_order_by_year "SELECT books.title, books.year FROM books JOIN series ON books.series_id = series.id WHERE series.id = 1 ORDER BY books.year;" end def select_name_and_motto_of_char_with_longest_motto "SELECT characters.name, characters.motto FROM characte...
true
12c06864e8006b1efd2e441592c8ea4c4972dbea
Ruby
Archethought/sapling
/lib/sapling/seed.rb
UTF-8
1,129
2.5625
3
[ "MIT" ]
permissive
module Sapling class Seed attr_reader :name, :associations def initialize(name) @name = name @attributes = [] @definition = Module.new @associations = {} end def model_class name.to_s.classify.constantize end def attributes Hash[ @attributes.map {|attr| [...
true
e1098f7c4b050d24074d57ea2b7fb11206b58d9c
Ruby
optionalg/quick-logger
/lib/quick-logger.rb
UTF-8
694
2.796875
3
[]
no_license
require 'logger' module Quick # quick and dirty logger: just inherit from here, # set the filename attribute then you're ready to go class Logger class << self attr_accessor :filename def filename_path if defined?(Rails) File.join Rails.root, 'log', [@filename, Rails.env, 'log'...
true
3ba8e698ca97417318520661e341d203d6c00091
Ruby
tmbx/tbxsos-config
/lib/reseller.rb
UTF-8
631
2.546875
3
[ "Apache-2.0" ]
permissive
# # Reseller class # require 'activator' require 'license' class Reseller def Reseller.is_reseller?(org_id=nil) begin if org_id.nil? org_kdn = Activator.main_org_id() org_id = Organization.find(:first, {:condition => ["name = ?", org_kdn]}).org_id end if not org_id.nil? ...
true
031e6074e254dc2c74629a0bba74cbad8b4d3c8f
Ruby
twopir/tnetstring-rb
/lib/tnetstring.rb
UTF-8
2,992
3.578125
4
[ "MIT" ]
permissive
module TNetstring def self.parse(tnetstring) payload, payload_type, remain = parse_payload(tnetstring) value = case payload_type when '#' payload.to_i when ',' payload when ']' parse_list(payload) when '}' parse_dictionary(payload) when '~' assert payload.leng...
true
950ce157fd077d7d0a8d792b39b4b50854698c66
Ruby
satanas/mango
/app/models/batch.rb
UTF-8
1,145
2.59375
3
[]
no_license
class Batch < ActiveRecord::Base belongs_to :order belongs_to :schedule belongs_to :user has_many :batch_hopper_lot validates_uniqueness_of :order_id, :scope => [:number] validates_presence_of :order, :schedule, :user, :start_date, :end_date validates_numericality_of :number, :only_integer => true, :grea...
true
022e142597b5af9c0dda13d3601dfe72ab544d90
Ruby
MamboZ/learn_ruby
/07_hello_friend/friend.rb
UTF-8
101
3.015625
3
[]
no_license
class Friend def greeting(who=nil) return who.equal?(nil)?"Hello!": "Hello, #{who}!" end end
true
81972b6bd22449af22201dec06bd07423ee94652
Ruby
domlet/phase-0-tracks
/ruby/secret_agents.rb
UTF-8
1,646
4.21875
4
[]
no_license
def encrypt(string) index = 0 encrypted_string = "" while index < string.length # respect space character if string[index] == " " encrypted_string += " " else # respect edge case of z's if string[index] == "z" encrypted_string += "a" else encrypted_string +=...
true
85a5d773071cbeea9edc6166a711d8decdb89781
Ruby
NNCT18J/ruby-cercil
/kodomocurry.rb
UTF-8
1,476
3.578125
4
[]
no_license
class Curry def initialize(a=3,b=300) #初期値は辛さ3量は300 @karasa=a @ryou=b end def setkarasa(a) @karasa=a end def setryou(b) if b<0 @ryou=300 puts "WARN:量として負の値は設定できません 勝手に初期値にします" else @ryou=b end end def ...
true
69c2d4a125dd320923faa4482d8530e2b37b5437
Ruby
hamcodes/prime-ruby-online-web-pt-071519
/prime.rb
UTF-8
269
3.34375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# first try # def prime?(num) # num = 0 # while num < 0 # return false if num % n == 0 # n += 1 # end # true # end def prime? (n) if n <= 1 false elsif n == 2 true else (2..n/2).none? { |i| n % i == 0} end end
true
8e45cac70aece5cef2da63856e98305f482d50ce
Ruby
luca-montaigut/Archives_THP
/4.5_gossip_project/lib/view.rb
UTF-8
545
3.015625
3
[]
no_license
# frozen_string_literal: true # Get gossip parameters class View def create_gossip puts "C'est quoi ton potion ?" content = gets.chomp.to_s puts "Hum intéressant ! Mais t'es qui au fait ?" author = gets.chomp.to_s return params = {content: content,author: author} end def index_gossips(all) ...
true
a798da3f103570299bb53a7cc46a74cb659b47de
Ruby
mikezila/GodMustAnswer
/rb/box2d.rb
UTF-8
2,257
3.375
3
[]
no_license
class Box2D attr_reader :left_foot, :right_foot, :height, :width attr_accessor :origin, :highlight def initialize(vec2, height, width) @origin = vec2 @highlight = false @height = height @width = width self.calc_points end def update self.calc_points end # The "v" variables are ...
true
86426c74e4e761f32ad4184ab98325108f911968
Ruby
ondrejfuhrer/brew
/Library/Homebrew/dev-cmd/contributions.rb
UTF-8
4,517
2.65625
3
[ "CC-BY-4.0", "BSD-2-Clause" ]
permissive
# typed: true # frozen_string_literal: true require "cli/parser" require "csv" module Homebrew extend T::Sig module_function SUPPORTED_REPOS = [ %w[brew core cask], OFFICIAL_CMD_TAPS.keys.map { |t| t.delete_prefix("homebrew/") }, OFFICIAL_CASK_TAPS.reject { |t| t == "cask" }, ].flatten.freeze ...
true
03c5a5993987314c24f0ee32e03df8fe664e4641
Ruby
NicGiles/battle_with_nic_and_cameron
/spec/game_spec.rb
UTF-8
782
2.84375
3
[]
no_license
require 'game' RSpec.describe Game do let(:jack) {double :david} let(:jill) {double :goliath} subject { described_class.new(jack, jill) } it "should attack player 2" do allow(jill).to receive(:get_attacked).and_return(true) expect(subject.player_1_attack).to eq true end it "should attack pla...
true
3a5202b8754050dee79967efaa844dbf10dc9ec3
Ruby
Khetti/weekend_homework_1
/pet_shop.rb
UTF-8
5,133
3.953125
4
[]
no_license
# function purpose: "What is the shop name?" # access the data(hash) and return the value attached to :name def pet_shop_name(shop_name) return shop_name[:name] end # function purpose: "How much cash does the shop have?" # access the data(hash) and return the value attached to :total_cash def total_cash(shop_cash) ...
true
565438f55b6496dfd69c04757c61c672d33810df
Ruby
StevenYee123/AAHomeworks
/W4D3/simon/lib/simon.rb
UTF-8
1,084
3.609375
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_sequen...
true
cc4bd6a28ede62f5a9385a25ad94b69abc2dd273
Ruby
tsmsogn/AOJ
/Volume_000/0030_Sum_of_Integers.rb
UTF-8
186
3.09375
3
[]
no_license
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] while line = gets n, s = line.chomp.split.map(&:to_i) break if n == 0 && s == 0 puts a.combination(n).select { |x| s == x.inject(:+) }.size end
true
3e43ff1a06ba2d14716073d6c850747d5eacd42c
Ruby
anhtran910/Ruby
/banking.rb
UTF-8
1,387
4.03125
4
[]
no_license
class Account attr_reader :name, :balance def initialize(name, balance=100) @name = name @balance = balance end def display_balance(pin_number) puts pin_number == pin ? "Balance: $#{@balance}." : pin_error end def withdraw(pin_number, amount) if pin_number == pi...
true
df27f43b84c4c68585ac6f7cb393057f275fc4f3
Ruby
wijet/backup
/lib/backup/storage/scp.rb
UTF-8
3,486
2.640625
3
[ "MIT" ]
permissive
# encoding: utf-8 ## # Only load the Net::SSH and Net::SCP library/gems # when the Backup::Storage::SCP class is loaded Backup::Dependency.load('net-ssh') Backup::Dependency.load('net-scp') module Backup module Storage class SCP < Base ## # Server credentials attr_accessor :username, :passwo...
true
64237dbd50dd56c59c397cb22d8cd8e364ad594a
Ruby
MarvinProg/film_selection
/lib/film_parser.rb
UTF-8
575
2.890625
3
[]
no_license
require 'nokogiri' require 'open-uri' require_relative 'film' module FilmParser WIKI_LINK = 'https://ru.wikipedia.org/wiki/250_лучших_фильмов_по_версии_IMDb'.freeze extend self def from_wiki html = open_request(WIKI_LINK) doc = Nokogiri::HTML(html) films_list = doc.css('tbody/tr')[1..] films_...
true
c2c28731a63c40b7f0ee2f62662c1ab5ca02d5a3
Ruby
daamnathaniel/cliapi
/lib/apicli/cliapi.rb
UTF-8
429
2.625
3
[]
no_license
# CLI controller, responsible for user interaction class WordSelector::CLI def call WordFinder::Request.new.find_words list_options menu end def list_options SAY.(Statment.greeting) sleep 1 SAY.(Statement) sleep 2 DISPLAY(request.response) DISPLAY = -> (data, method...
true
6fabcb47732e3d92eea88fc8f8a2d216205478ae
Ruby
baezanat/Launch_School_bootcamp
/exercises/RB101_109/easy/easy9_5.rb
UTF-8
839
4.40625
4
[]
no_license
=begin Write a method that takes a string argument, and returns true if all of the alphabetic characters inside the string are uppercase, false otherwise. Characters that are not alphabetic should be ignored. Examples: uppercase?('t') == false uppercase?('T') == true uppercase?('Four Score') == false uppercase?('FOUR...
true
5a3ee8d032156fee314f1e9186d1683a1498b62e
Ruby
MousbahFil/Web-Workspace
/Ruby/SubStrings.rb
UTF-8
248
3.015625
3
[]
no_license
def substrings(word, strings) result=Hash.new word=word.downcase strings.each do |s| if(word.include? s.downcase) result.store(s, word.downcase.scan(s.downcase).length) end end result end
true
d469cae940e6229de71401091fd8ac3579e12f83
Ruby
merongivian/library-management
/lib/library_management/order_manager.rb
UTF-8
1,642
3.203125
3
[]
no_license
module LibraryManagement class OrderManager attr_reader :name, :id, :order_date, :pick_date, :penalty, :picked def initialize(order) @name = order.book.name @order_date = order.created_at @pick_date = if order.picked_up_at order.picked_up_at else calculate_pick_date(order....
true
d85aaf3114e5245b54c847719dba0d97952e52dd
Ruby
JoshCheek/object_model_8th_light
/challenges/flight_of_the_conchords.rb
UTF-8
967
3.703125
4
[]
no_license
# ===== Silence!! DEstroy him!! ===== # Dew! Bew! Dew-dew-dew! Bew! module InSpace attr_reader :current_status def initialize(current_status, *whatevz) @current_status = current_status super(*whatevz) end end class Human attr_reader :name def initialize(name) @name = name end end class Stud...
true
2eb3ae29021c0621862b3f35e4b870ec9b4b9c29
Ruby
sfgeorge/loquacious
/examples/nested.rb
UTF-8
1,749
2.515625
3
[ "MIT" ]
permissive
# Here we show how to used nested configuration options by taking a subset # of some common Rails configuration options. Also, descriptions can be give # before the option or they can be given inline using Ruby hash notation. If # both are present, then the inline description takes precedence. # # Multiline description...
true
d299bbf65c427ff40029b9f3471917dd728eb67b
Ruby
ess/belafonte
/examples/cmd
UTF-8
1,007
2.875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'belafonte' class TrueApp < Belafonte::App title "true" summary "Just like system true" description "All this does is exit with a 'true' value" def handle kernel.exit(0) end end class Echo < Belafonte::App title "echo" summary "Just like system echo" description "Thi...
true
25482c756b8631e0614463430f6c17c093b0182c
Ruby
brianseitel/oasis-rubymud
/modules/level.rb
UTF-8
1,755
3.4375
3
[]
no_license
# # Module to handle level definitions, calculate level gains, modify attributes, and so on. # # def gain_exp # def gain_level # @author [brianseitel] # class Level EXP_TO_LEVEL = 1000 # # Calculate the amount of experience and increase the player's exp count/ # @param player Player the player gaining exper...
true
a2cd2e5ac4c107b32699833b68d9e38b7edd6239
Ruby
IlyaMur/ruby_learning
/RubyRush_school/Lesson7/reverse.rb
UTF-8
535
3.4375
3
[]
no_license
array_to_invert = [1, 2, 3, 4, 5, 6, 7] puts "Исходный массив: #{array_to_invert.to_s}" flag = false buff = 0 until flag == true flag = true 0.upto(array_to_invert.size - 2) do |i| if array_to_invert[i] < array_to_invert[i+1] buff = array_to_invert[i] array_to_invert[i] = array_to...
true
afd9e60668df52928100eda54df81e5ac5656478
Ruby
Jennythompson17/codebar_projects
/Write to file examples/write_to_csv.rb
UTF-8
470
2.875
3
[]
no_license
require "open-uri" remote_base_url = "http://en.wikipedia.org/wiki" remote_page_name = "Ada_Lovelace" remote_full_url = remote_base_url + "/" + remote_page_name puts "Downloading from:" + remote_full_url remote_data = open(remote_full_url).read my_local_filename = "my_copy_of-" + remote_page_name + ".csv"...
true
d8ffcf7790a8a10109a202b5b1b44adb9f9cc8b6
Ruby
Marti-Dolce-Flatiron-School-Projects/ruby-oo-complex-objects-putting-the-pieces-together
/lib/shoe.rb
UTF-8
395
3.1875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# frozen_string_literal: true # brand: Martinique Dolce # Course: Flatiron School 2020, November 9 - 20201, April 2021 # Contact: me@martidolce.com | https://modis.martidolce.com # # shoe.rb class Shoe attr_reader :brand attr_accessor :material, :size, :color, :condition def initialize(brand) @brand = bran...
true
33f4d3accc0bdbf2526ae9d618cf91f033003307
Ruby
elthariel/radioschlag
/lib/sox/audio_file.rb
UTF-8
2,412
2.53125
3
[]
no_license
#! /usr/bin/ruby ## audio_file.rb ## Login : <opp2@opp2-devsrv> ## Started on Tue Dec 1 23:32:27 2009 opp2 ## $Id$ ## ## Author(s): ## - opp2 <> ## ## Copyright (C) 2009 opp2 ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published b...
true
a88474d45a29222b2c247ab67750283bb8d9fc47
Ruby
paulvidal/web-crawler
/src/static_assets_parser.rb
UTF-8
1,047
2.796875
3
[]
no_license
require_relative 'url_parser' module StaticAssetsParser def StaticAssetsParser.find_static_assets(parsed_html, crawler) asset_links = [] script_assets = parsed_html.css('script') script_assets.each do |script| asset_links << script['src'] end link_assets = parsed_html.css('link') lin...
true
f21094e49f4959ce174e74cb5ce783e0fa286e1e
Ruby
onigra/slice_by_indexes
/spec/extention/array_spec.rb
UTF-8
1,930
2.71875
3
[ "MIT" ]
permissive
require File.expand_path(File.join('../', 'spec_helper'), File.dirname(__FILE__)) describe Array do describe '#indexes' do context 'case1' do let(:ary) { [1, 2, 3, 1, 2] } subject { ary.indexes 1 } it { should eq [0, 3] } end context 'case2' do let(:ary) { [1, 2, 3, 1, 2, 1, 1, ...
true
43469fe6ede17a9b6b626d63931f9af949ff6b9e
Ruby
hamza3202/repositext
/lib/repositext/validation/utils/reporter_json.rb
UTF-8
2,751
2.734375
3
[ "MIT" ]
permissive
class Repositext class Validation # This Reporter collects data during validation and once the validation is # complete, it prints the data as JSON to $stdout so it can be consumed # by the calling process. class ReporterJson < Reporter attr_reader :errors, :warnings, :stats VALIDATION_...
true
0fb9c15e135bfc1aca97baccb840bef64244cdce
Ruby
ThaiNguyen-wakumo/testing
/Maths.rb
UTF-8
195
3.21875
3
[]
no_license
require 'pry' class Maths class DivZeroError < StandardError; end def sum(a, b) a + b end def div(a, b) raise DivZeroError if b == 0 a / b end end binding.pry puts "Done"
true
6d94beeb2c593a6b9f20753da4ac76e751cdc729
Ruby
hackforchange/igotugot
/lib/models.rb
UTF-8
1,815
2.671875
3
[]
no_license
require 'rubygems' require 'active_record' dbconfig = YAML.load(File.read('./config/database.yml')) env = ENV['SINATRA_ENV'] || 'production' ActiveRecord::Base.establish_connection (dbconfig['production']) class User < ActiveRecord::Base has_many :tags, :through => :taggings has_many :taggings has_many :posts e...
true
d1c535b20699b2d963b46122b86c555b583e3ded
Ruby
iExperience/session0202_exercises
/JoshBroomberg-JoshBroomberg/d2/2B/Leapyears.rb
UTF-8
269
3.9375
4
[]
no_license
puts "Enter a starting year:" startYear = gets.chomp.to_i puts "Enter an ending year:" endYear = gets.chomp.to_i puts "The leap years are:" for year in (startYear..endYear) if year%4==0 if year%100!=0 puts year elsif year%400 ==0 puts year end end end
true
ec7f33d697db84b62c4799d13cea8b561f402c7a
Ruby
coq-bench/make-html
/result.rb
UTF-8
2,504
2.578125
3
[ "MIT" ]
permissive
require_relative 'status' # The result of a bench. class Result attr_reader :status, :context, :lint_command, :lint_status, :lint_duration, :lint_output, :dry_with_coq_command, :dry_with_coq_status, :dry_with_coq_duration, :dry_with_coq_output, :dry_without_coq_command, :dry_without_coq_status, :dry_with...
true
d971636b594fda821c04e8c853161b3ce688dd79
Ruby
raglub/sea_battle
/lib/sea_battle/board.rb
UTF-8
4,003
3.3125
3
[ "MIT" ]
permissive
# encoding: utf-8 require_relative "cell" require_relative "random_ship" require_relative "support" class SeaBattle # It's Board of game Sea Battle class Board include ::SeaBattle::Support attr_reader :board, :vertical, :horizontal, :status def initialize(board = "1" * 100, status = :initialized) ...
true
86f822531b28784c5038ebd36b1afe9def851371
Ruby
richo225/battleships_tech_test
/lib/game.rb
UTF-8
732
3.921875
4
[]
no_license
class Game attr_accessor :ships, :computer def initialize @ships = [] @computer = [] end def position(cell) @ships << cell end def start (@computer << random_ships).flatten! end def fire(cell) hit?(cell)? sink_ship(cell) : fire_back(random_shot) end def fire_back(cell) ...
true
cb2dacf612b911ffceec61bdee01bd760479121b
Ruby
rock-core/tools-pocolog
/lib/pocolog/stream_aligner.rb
UTF-8
24,733
2.765625
3
[]
no_license
module Pocolog class StreamAligner attr_reader :use_rt attr_reader :use_sample_time attr_reader :base_time attr_reader :streams # Provided for backward compatibility only def count_samples Pocolog.warn "StreamAligner#count_samples is deprecated. Use #si...
true
945fd6271f1a8467d666c46b5f14580ec7453491
Ruby
TeresaCreech/CSCI3308
/Ruby Assignment/4b_RockPaperScissors.rb
UTF-8
1,516
4.15625
4
[]
no_license
# Part4b: Rock Paper Scissors class WrongNumberOfPlayersError < StandardError ; end class NoSuchStrategyError < StandardError ; end def rps_game_winner(game) # Winning moves gamewinning = { "r" => "s", "s" => "p", "p" => "r" } game[0][1] = game[0][1].downcase game[1][1] = game[1][1].downcase # Make sure the...
true
8db4ba59be6d16a0fd8579f8fa4277c91ee9e948
Ruby
Jeantirard/exo
/exo_15.rb
UTF-8
184
3.625
4
[]
no_license
puts "Quelle est ton année de naissance?" année= gets.chomp année= année.to_i x = 0 while année <= 2017 puts "En #{année} tu avais #{x} ans." année += 1 x += 1 end
true
373d3c09735a88b267414c2270f3be91d05dfb02
Ruby
leonimanuel/prime-ruby-online-web-sp-000
/prime.rb
UTF-8
203
3.171875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" def prime?(num) if num <= 1 return false end i = 2 divisors = [] while i <= (num / 2) divisors << i i += 1 end divisors.all? {|x| num % x != 0} end # binding.pry
true
4d7c4fe79d05f7b2b5de0e43af3bdd728fc9292b
Ruby
VarvaraBabkova/oo-relationships-practice
/app/models/user.rb
UTF-8
494
3.171875
3
[]
no_license
class User attr_accessor :name @@all = [] def initialize(name) @name = name @@all << self end def self.all @@all end def pledges Pledge.all.select {|p| p.pledger == self} end def projects pledges.map {|p| p.project} end def self.highest_pledge Pledge.all.max {|p, b| p.money <=> b.money}.pl...
true
4d88c74ed8154d43985111e1f6f51ac051cfc9e2
Ruby
agirdler-lumoslabs/my_bar
/juice_bar_spec.rb
UTF-8
5,084
2.578125
3
[]
no_license
require 'juice_bar' describe '#juicer_gimme' do subject { juicer_gimme(my_request, at) } context 'beet juice' do let(:my_request) { {'Beet Juice' => 1} } context 'regular hours' do let(:at) { '13:00' } let(:my_drinks) { ['Beet Juice'] } let(:my_bill) { 5.0 } it { is_expected.to m...
true
2fefb05144862a08077ad36a1245be1213f22d83
Ruby
jackrobbins1/prime-ruby-chicago-web-career-040119
/prime.rb
UTF-8
250
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def prime?(int) if int < 2 return false elsif int == 2 return true else array = Array(2...int) array.each do |el| if int % el == 0 return false else next end end return true end end
true
0486501bd36167d263063f1717f6c1aa1bd05b13
Ruby
ii-lo/pelp
/spec/helpers/pastel_helper_spec.rb
UTF-8
724
2.65625
3
[ "MIT" ]
permissive
require 'rails_helper' # Specs in this file have access to a helper object that includes # the PastelHelper. For example: # # describe PastelHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # end ...
true
60f604fee18ff984f443f87493168463c621ed72
Ruby
LinaGallardo/RubyExercises
/class_exercise7.rb
UTF-8
963
3.8125
4
[]
no_license
# Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. class SquaresNumber def initialize(num) @num = num end def squares square_sum = (1..@num).sum ** 2 sum_square = (1..@num).map { |num| num ** 2 }.sum difference = (square_su...
true
cfa9409ea42d216095c2f189011e613d25ae0921
Ruby
jwarchol/soulmate-goliath
/lib/soulmate/loader.rb
UTF-8
1,401
2.8125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module Soulmate class Loader < Base def load(items) # delete the sorted sets for this type # wrap in multi/exec? phrases = Soulmate.redis.smembers(base) phrases.each do |p| Soulmate.redis.del("#{base}:#{p}") end Soulmate.redis.del(base) # Redis can continue ser...
true
a67f8a606469a432c97b0a376bf249eff24c6e2d
Ruby
berfarah/config
/bin/run
UTF-8
2,184
2.703125
3
[]
no_license
#!/usr/bin/env ruby case ARGV.first when "encrypt" from = "decrypted" to = "encrypted" nodiff = true when "decrypt" from = "encrypted" to = "decrypted" flags = "-d" else puts "Usage: #{__FILE__} [encrypt|decrypt]" exit 1 end require "fileutils" require "pathname" ROOT_PATH = Pathname.new...
true
0d7c16d74966b2c8a5e9e65450c7af419e12ea0c
Ruby
whatalnk/cpsubmissions
/atcoder/ruby/abc097/abc097_a/2624137.rb
UTF-8
430
3.109375
3
[]
no_license
# Contest ID: abc097 # Problem ID: abc097_a ( https://atcoder.jp/contests/abc097/tasks/abc097_a ) # Title: A. Colorful Transceivers # Language: Ruby (2.3.3) # Submitted: 2018-06-06 01:36:29 +0000 UTC ( https://atcoder.jp/contests/abc097/submissions/2624137 ) a, b, c, d = gets.chomp.split(" ").map(&:to_i) if (a - c).a...
true
c82a832544b77b1ceaa67221f73d931ae2ae2a09
Ruby
remylombard/fullstack-challenges
/02-OOP/05-Food-Delivery-Day-One/01-Food-Delivery/app/controllers/sessions_controller.rb
UTF-8
556
2.75
3
[]
no_license
require_relative "../views/sessions_view" class SessionsController def initialize(employee_repo) @employee_repo = employee_repo @view = SessionsView.new end def sign_in # 1. Ask the username username = @view.ask_for_username # 2. Ask the password password = @view.ask_for_password # ...
true
ef3b03e29cce6cb9d121742713d5fcda6e7b65b9
Ruby
tblanchard01/Boris_Bikes
/spec/docking_station_spec.rb
UTF-8
503
2.625
3
[]
no_license
require 'docking_station' describe DockingStation do describe '#release_bike' do it 'releases a bike' do bike = Bike.new subject.dock(bike) expect(subject.release_bike).to eq bike end it 'raises an error when there are no bikes available' do expect{subject.release_bike}.to raise_error 'No bikes ar...
true
f62690a26978544924b7351efedd5814f8b6e740
Ruby
msrashid/Exercise-sets-for-101-109---Small-Problems
/easy5/ex2.rb
UTF-8
357
3.515625
4
[]
no_license
def time_of_day(integer) hours = integer / 60 % 24 minutes = integer % 60 p "#{hours.to_s.rjust(2, "0")}:#{minutes.to_s.rjust(2, "0")}" end p time_of_day(0) == "00:00" p time_of_day(-3) == "23:57" p time_of_day(35) == "00:35" p time_of_day(-1437) == "00:03" p time_of_day(3000) == "02:00" p time_of_day(800) == "1...
true
83f7e396618359479ec317ff9ef4d304ccc7a394
Ruby
reakiro/codebreaker-gem
/lib/codebreaker/game.rb
UTF-8
762
3.125
3
[]
no_license
require_relative 'validations' require_relative 'comparing' module Codebreaker class Game include Validations include Comparing attr_reader :secret_number, :attempts_number, :hints_number def initialize(attempts_number, hints_number) @secret_number = secret_number_generate @attempts_num...
true
63ef823f38297728cf9afb1ed151cb648a34d697
Ruby
rubiety/battleship
/app/models/game.rb
UTF-8
1,885
2.8125
3
[]
no_license
class Game < ActiveRecord::Base has_many :ships, dependent: :destroy has_many :rounds, dependent: :destroy has_many :fires, through: :rounds after_create :create_ships ROUNDS = 6 FIRES_PER_ROUND = 5 SIZE = 16 def points value = points_from_sinking_ships - fires.where("rounds.fires_count >= 5").wh...
true
88601acdd7a1a0e3b52370f663b4de7ee9cfa9fd
Ruby
eladmeidar/diakonos
/lib/diakonos/buffer/delete.rb
UTF-8
4,295
2.515625
3
[ "MIT" ]
permissive
module Diakonos class Buffer # x and y are given window-relative, not buffer-relative. def delete if selection_mark delete_selection else row = @last_row col = @last_col if ( row >= 0 ) and ( col >= 0 ) line = @lines[ row ] if col == line.lengt...
true
ffbabf73ddab32a4a160dd122cb9f0f733491a6e
Ruby
jkriss/yesorno
/yesorno.rb
UTF-8
1,284
2.625
3
[]
no_license
require 'rubygems' require 'bundler' Bundler.setup Bundler.require require 'open-uri' def latest_tweet(screen_name) screen_name = screen_name[0,15] begin json = open("https://api.twitter.com/1/statuses/user_timeline.json?screen_name=#{screen_name}&count=1").read tweet = JSON.parse(json)[0] text = tweet...
true
a9803df03cf462cf6201d30dabce4abdb72cf186
Ruby
adbeel92/rails-challenge
/app/concepts/links/operations/update.rb
UTF-8
589
2.515625
3
[]
no_license
# frozen_string_literal: true module Links module Operations class Update attr_reader :link def initialize(link:, original_url:) @link = link @original_url = URI.decode_www_form_component(original_url.strip) end def run assign_attributes return true unles...
true
c18550a33022505d63abbba6ef3b0feec1ee85c2
Ruby
tddycks/dynamic-orm-lab-v-000
/lib/interactive_record.rb
UTF-8
1,663
2.890625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative "../config/environment.rb" require 'active_support/inflector' require 'pry' class InteractiveRecord def self.table_name self.to_s.downcase.pluralize end def self.column_names #end result is "column_name_one", "column_name_two" etc DB[:conn].results_as_hash = true sql = "PRAGMA...
true
277c5f2b1eb8d8b484e5df8bfddedaffcabe47a9
Ruby
dlonra22/operators-online-web-pt-081219
/lib/operations.rb
UTF-8
171
2.671875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def unsafe?(speed) if (speed > 39) && (speed < 61) return false else return true end end def not_safe?(speed) ((speed > 39) && (speed < 61))? false : true end
true
e924ccb0855b5c4b4ea92cbdcf72a31d98fd39e2
Ruby
marceloluizleite/shortener_of_url
/shortener.rb
UTF-8
548
2.6875
3
[]
no_license
require 'sinatra' get '/' do erb :index; end __END__ @@ layout <!DOCTYPE html> <html> <head> <meta charset="UTF-8"/> <title>Encurtador de URL</title> </head> <body> <%= yield %> </body> </html> @@ index <h1 align="center">Encurtador de URL'S:</h1> <h2> <form action="/" method="...
true
ef822845ca7bc837b585aa4f09ee7e9b7c3572b8
Ruby
dqmrf/dive-in-ruby
/sandbox/errors_handling/resque/base.rb
UTF-8
183
3.859375
4
[]
no_license
print 'Enter a number: ' n = gets.to_i begin result = 100 / n rescue ZeroDivisionError puts "Your number didn't work. Was it zero???" exit end puts "100/#{n} is a #{result}"
true
2a3feeffe4d8ace460f00bcbc39f7b9393ed074a
Ruby
eebbesen/minutes_maid
/vendor/cache/ruby/2.5.0/gems/ruby-hmac-0.4.0/test/test_hmac.rb
UTF-8
2,322
2.578125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby $: << File.dirname(__FILE__) + "/../lib" require "hmac-md5" require "hmac-sha1" begin require "minitest/unit" rescue LoadError require "rubygems" require "minitest/unit" end MiniTest::Unit.autorun class TestHmac < MiniTest::Unit::TestCase def test_s_digest key = "\x0b" * 16 text ...
true
c4217c0ab345d348c9fcd7d9bcaf805ca6f59064
Ruby
codism15/rwin
/remove-qoutes.rb
UTF-8
2,388
2.921875
3
[]
no_license
# pgAdmin 3 double quote the data being copied. This script is to remove the double # quotation marks before paste require 'clipboard' require 'optparse' require 'logger' Encoding.default_internal = Encoding::UTF_8 $log = Logger.new(STDERR) options = OptionParser.new do |opts| opts.banner = "Usage: #{File.base...
true
c407317f0b3b023975979f095c8f0a23d4b62e82
Ruby
oaxacarb/ruby_blocks
/04_lambdas_y_procs/02_creacion_y_ejecucion_de_lambdas_y_procs_con_parametros.rb
UTF-8
153
3.546875
4
[]
no_license
variable_lambda = lambda { |x| puts x } variable_proc = Proc.new { |x| puts x } variable_lambda.call("hola") # hola variable_proc.call("mundo") # mundo
true
45391114d0fd03fefa88ba6ea5e2840ef6ba12cd
Ruby
itacademy-ruby/nevgeniy_lake
/ducks_lake.rb
UTF-8
1,233
3.171875
3
[]
no_license
# encoding: utf-8 # Duck module Flying def fly 'Flying' end def reactive_fly "reactive_fly" end def mechanical_fly "mechanical_fly" end end module Quacking def quacking 'Quacking' end end module Swiming def swiming 'Swiming' end end module Eating def eating 'Eating...
true
32b7cce3a11c529075377bb74645e8cae6e6ec32
Ruby
igorsimdyanov/ruby
/class_methods/ticket_set_get.rb
UTF-8
245
3.171875
3
[]
no_license
class Ticket def initialize(date:, price: 500) @price = price @date = date end def set_price(price) @price = price end def price @price end def set_date(date) @date = date end def date @date end end
true
6cda342dcca85528c044d10c6bf73d53a98cec46
Ruby
Varunram/Compiler
/parser.rb
UTF-8
1,381
2.859375
3
[]
no_license
require_relative 'parserbase' require_relative 'sexp' class Parser < ParserBase def initialize s @s = s @sexp = SEXParser.new(s) end def parse_name @s.expect(Atom) end def parse_arglist rest = false if (@s.expect("*")) rest = true @s.ws end name = parse_name rais...
true
0e5232463959a589f3b33360bcd3bca50148ff7b
Ruby
javibolibic/napakalaki1516
/Napakalaki_Ruby/pkg/Napakalaki_Ruby-0.0.1/lib/monster.rb
UTF-8
1,354
2.890625
3
[]
no_license
# encoding: utf-8 =begin ******************************************************************** ** _ _ _ _ _ _ ** ** | \ | | __ _ _ __ __ _| | ____ _| | __ _| | _(_) ** ** | \| |/ _` | '_ \ / _` | |/ / _` | |/ _` | |/ / | ** ** | |\ | (_...
true
db2c8f504f320f185f37a7c615078c01df3692ef
Ruby
Telixia/leetcode-3
/Easy/1700-Number of Students Unable to Eat Lunch/Simulation.rb
UTF-8
524
3.265625
3
[]
no_license
# @param {Integer[]} students # @param {Integer[]} sandwiches # @return {Integer} def count_students(students, sandwiches) students = Containers::Queue.new(students) count = [0, 0] i = 0 students.each do |prefer| count[prefer] += 1 end until students.empty? prefer = students.pop if prefer == s...
true
34d8dbd9247a4a9026d7102ad03fe82d66c02cb5
Ruby
kientn123/programming_problems
/epi/Ruby/list_05.rb
UTF-8
758
3.34375
3
[]
no_license
=begin determine if a singly linked list is cyclic =end require "libraries" def is_cyclic(l) return nil if l.next.nil? or l.next.next.nil? runner1 = l runner2 = l while true if runner2.next.nil? or runner2.next.next.nil? return "nil" else runner1 = runner1.next runner2 = runner2.next....
true
b0067983e5dd2a13bb8fc1687c2ff604b8516d54
Ruby
kevinmacarthur/math_game
/player.rb
UTF-8
231
3.4375
3
[]
no_license
class Player attr_accessor :lives, :name, :points def initialize(name) @name = name @lives = 3 @points = 0 end def lose_life @lives -= 1 end def add_point @points += 1 end end
true
8f741414edebd57c8f88dcba0b84b968f4a22ea3
Ruby
savardd/material-icons
/gen/generate.rb
UTF-8
5,118
2.546875
3
[ "BSD-3-Clause" ]
permissive
require "rubygems" require "active_support/core_ext/hash" require "active_support/inflector" require "fileutils" # Constants # ========= ROOT = %x`git rev-parse --show-toplevel`.chomp SOT_DIR = File.join ROOT, "tmp", "sot" OUT_DIR = File.join ROOT, "tmp", "out" SKIP_CATS = %w(iconfont sprites) # Setup # ===== # ...
true
c096e576c697f14a7af49a37030fbca33327f46d
Ruby
lbredeso/crashfinder
/lib/tasks/crash.rake
UTF-8
3,445
2.578125
3
[ "MIT" ]
permissive
require 'mn/crash_converter' require 'mn/location_generator' require 'nd/crash_converter' require 'sd/crash_converter' require 'set' require 'csv' BATCH_SIZE = 1000 namespace :crash do desc "Load crash data" task :load, [:state, :start_year, :end_year] => :environment do |t, args| state = args.state state...
true
7df01b1ffa9747a568d0b369fdff8b6da7062bfe
Ruby
jfangonilo/tv_network_1909
/lib/character.rb
UTF-8
267
3.25
3
[]
no_license
class Character attr_reader :name, :actor def initialize(attributes) @name = attributes[:name] unless nil @actor = attributes[:actor] unless nil @salary = attributes[:salary] unless nil end def salary @salary.to_s.delete("_").to_i end end
true
dc4da674f140ce66c9f50b68f7210bdd94e8adab
Ruby
kid/torrentui
/app/models/downloaded_file.rb
UTF-8
734
2.578125
3
[]
no_license
require 'unrar' class DownloadedFile < ActiveRecord::Base attr_accessible :length, :path belongs_to :torrent validates_presence_of :path def file_name File.split(path).last end def is_archive? file_name.end_with? '.rar' end def absolute_path File.expand_path File.join(AppSett...
true