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
b49a112e264e3a81a321d65ca4054c59efd61afe
Ruby
BenUlcoq/PP0109
/calculator_test.rb
UTF-8
549
3.28125
3
[]
no_license
require 'test/unit' require_relative 'calculator' class CalculatorTest < Test::Unit::TestCase def test_add total = add(1,2) assert_equal(3, total) end def test_subtract total = subtract(10,5) assert_equal(5, total) end def test_multiply total = multiply(5,4...
true
d675ca984e6dc0e40eaccd0933ea90d9191eb6ac
Ruby
pelicularities/katas
/phone_book.rb
UTF-8
936
4.125
4
[]
no_license
# Enter your code here. Read input from STDIN. Print output to STDOUT # Input format: # (Int) n = number of entries in phone book # (str) name phone_number # ... repeated n times # (str) name # ... repeated until end of input # get number of entries in phone book n = gets.chomp.to_i # populate phone book phone_book ...
true
52e23cc11d8d53f3ba4ee9934c3557c42a0cd58f
Ruby
freebz/Mastering-Ruby-Closures
/ch02/ex2-7.rb
UTF-8
361
2.828125
3
[]
no_license
# Block Pattern #2: Managing Resources f = File.open('Leo Tolstoy - War and Peace.txt', 'w') f << "Well, Prince, so Genoa and Lucca" f << " are now just family estates of the Buonapartes." f.close File.open('Leo Tolstoy - War and Peace.txt', 'w') do |f| f << "Well, Prince, so Genoa and Lucca" f << " are now just...
true
58892b8d4c5c119501c7bea7399a52d4340f40cd
Ruby
hoongman/borisbikes
/lib/borisbikes.rb
UTF-8
344
2.53125
3
[]
no_license
require_relative 'bike' require_relative 'person' require_relative 'station' require_relative 'van' require_relative 'garage' bike1=Bike.new(false) bike2=Bike.new(false) bike3=Bike.new(false) bike4=Bike.new(true) station1 = Station.new([bike1,bike2,bike3,bike4]) station2 = Station.new person = Person.new garage = G...
true
b843fa1a52a0bc35cb410309b6df112446837bd9
Ruby
sdmalek44/black_thursday
/lib/item_repository.rb
UTF-8
1,256
2.90625
3
[]
no_license
require_relative 'repository' require_relative 'item' require 'time' class ItemRepository include Repository def initialize(loaded_file) @repository = loaded_file.map { |item| Item.new(item) } end def find_by_name(name) all.find { |item| item.name == name } end def find_all_with_description(desc...
true
a25e2d1d92843b6a871bab76a07227dff96253b3
Ruby
shioimm/til
/practices/druby/druby_book/dcp.rb
UTF-8
1,039
2.828125
3
[]
no_license
# 参照: dRubyによる分散・Webプログラミング require 'drb/drb' class DCP include DRbUndumped def size(fname) File.lstat(fname).size end def fetch(fname) File.open(fname, 'rb') do |fp| while buf = fp.read(4096) yield buf end end end def store_from(there, fname) size = there.size(fname)...
true
289668dd482a202b4213227eaa8a07ea6ab6d48e
Ruby
blakemiles/ruby
/studio_game/studio_game_mod10.rb
UTF-8
988
3.875
4
[]
no_license
class Player def score @health + @name.length end def initialize(name, health=100) @name = name.capitalize @health = health end def to_s "I'm #{@name} with a health of #{@health} and a score of #{score}." end def blam @health -= 10 puts "#{@name} got blammed!" end def w00t @health += 15 p...
true
f237cab7a58193f33433fc6a129e8007f7da5fd0
Ruby
braiba/telemetrics-project-ruby
/test/models/journey_test.rb
UTF-8
693
2.515625
3
[]
no_license
require 'test_helper' class JourneyTest < ActiveSupport::TestCase def setup @journey = Journey.find(1) end test 'highest point' do lat_long = @journey.highest_point assert_in_delta lat_long.latitude, 51.5056, 0.0001 assert_in_delta lat_long.longitude, 0.0756, 0.0001 end test 'lowest altitu...
true
7d767c16b4c50363bc581f19dc6945e5597e2c96
Ruby
seaneshbaugh/portfolio
/test/validators/javascript_validator_test.rb
UTF-8
1,150
2.59375
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'test_helper' class JavascriptValidatorTest < ActiveSupport::TestCase class DummyClass include ActiveModel::Model include ActiveModel::Validations attr_accessor :script validates :script, javascript: true end test 'valid JavaScript' do dummy_object = ...
true
8f8f8921b82f6cdf81a3cae42781a9bcdc74b157
Ruby
cranieri/checkout-system
/lib/item.rb
UTF-8
178
2.8125
3
[]
no_license
class Item attr_reader :name attr_accessor :price def initialize(code) @name = Products::PRODUCTS[code][:name] @price = Products::PRODUCTS[code][:price] end end
true
d9462ab7485a833058f61d1d12c9d42747aa1629
Ruby
ngeballe/ls-exercises-challenges
/medium2/other files/other practice/own_each_with_object_and_reduce.rb
UTF-8
1,023
3.890625
4
[]
no_license
require 'pry' def each_with_object(array, object) array.each do |item| yield(item, object) end object end def reduce(array, accumulator = nil) accumulator ||= array.shift array.each do |item| accumulator = yield(accumulator, item) end accumulator end # In reduce, goal is one thing -- it returns...
true
c8f10587effa56f1f549de1fd1da15d204da41d2
Ruby
rpardee/pci4r
/lib/filtering.rb
UTF-8
19,047
3.140625
3
[]
no_license
require "set" require "stemmer" ## # This module provides a number of +Classifier+ classes that are instantiated, # trained with sample text, and used to classify new bits of text. The base # class, +Classifier+, provides the basic capabilities. Two sub-classes, # +NaiveBayes+ and +Fisher+ provide more specific classi...
true
22f9831a9e07a57d30494968aceda6d5495c1285
Ruby
yast/zombie-killer
/lib/zombie_killer/eager_rewriter.rb
UTF-8
3,779
2.75
3
[ "MIT" ]
permissive
# frozen_string_literal: true require "unparser" require "set" require "zombie_killer/rule" # Rewrite Zombies with their idiomatic replacements class EagerRewriter < Parser::TreeRewriter def self.s(name, *children) Parser::AST::Node.new(name, children) end def s(name, *children) self.class.s(name, *ch...
true
5ed43a899452e5c8a98eb5f1bd59fe41ead8c7f8
Ruby
AllPurposeName/runewords-api
/lib/tasks/import_data.rake
UTF-8
1,777
2.921875
3
[]
no_license
require 'yaml' require 'colorize' namespace :data do desc 'Import all the Runeword YAML files into models in our DB.' # NOTE: # This is only valid when run after dropping and re-generating the DB # since the ids need to start from 1 so that foreign keys will match up task import: :environment do runes_fil...
true
5121ea959897acb8eb8d1dc7fb80decf4d4c70fd
Ruby
zare926/activerecord_lessons
/main.rb
UTF-8
1,024
2.6875
3
[]
no_license
require 'active_support/all' require "active_record" # ppはプリティープリント、オブジェクトをわかりやすく表現するrubyのライブラリ require 'pp' # 時間の設定、決まり文句ぐらいで覚える Time.zone_default = Time.find_zone! 'Tokyo' ActiveRecord::Base.default_timezone = :local # DBの読み込み ActiveRecord::Base.establish_connection( "adapter" => "sqlite3", "database" => "./mya...
true
d0294a23eae1e9f593b05f9af5afa8b090adcb1f
Ruby
karolinee/University
/Programowanie obiektowe/lista8/zad3.rb
UTF-8
618
3.640625
4
[]
no_license
class Jawna def initialize(napis) @napis = napis end def zaszyfruj(klucz) kod = "" @napis.each_char { |i| kod << klucz[i]} return Zaszyfrowane.new(kod) end def to_s "Napis jawny: " + @napis end end class Zaszyfrowane def initialize(napis) @napis = napis end def odszyfruj(klucz...
true
eb4cff09d2fcd8f5d48620a42a83973dfed1cf15
Ruby
ShanaLMoore/project-euler-multiples-3-5-e-000
/lib/multiples.rb
UTF-8
271
3.46875
3
[]
no_license
# Enter your procedural solution here! def collect_multiples(limit) multiples = [] for num in 1 ... limit if (num % 3 == 0) || (num % 5 == 0) multiples << num end end multiples end def sum_multiples(limit) collect_multiples(limit).inject(:+) end
true
19e4e3eca60acb6afbaa08bd517e254d6b4b951d
Ruby
venkatd/compute
/lib/compute/computation.rb
UTF-8
857
2.8125
3
[ "MIT" ]
permissive
module Compute class Computation attr_accessor :property def initialize(model, property, &block) @model = model @property = property @proc = Proc.new(&block) end def dependencies @dependencies ||= calculate_dependencies(@proc) end def needs_update?(changed_properti...
true
9c7319a52325d0bf7ad4ac2f94e11c87efcdaaa5
Ruby
reactormonk/magic_search
/cards/lib/magic_cards.rb
UTF-8
1,818
2.8125
3
[]
no_license
require 'nokogiri' require 'mana_symbols' module MagicCards class Rules def initialize(xml) @xml = xml end def each(&block) enum_for(:to_s, &block) end def rules @xml.xpath('./rule') end def to_a rules.map(&:text) end def by_no rules.group_by {|e|...
true
548a31b0472da4e9eb96deb36c901b890eaf96c6
Ruby
NilsLoewe/archive
/versuche/leo-v1/app/models/objective.rb
UTF-8
2,302
2.640625
3
[]
no_license
# == Schema Information # # Table name: objectives # # id :integer not null, primary key # title :string(255) # description :text # category_id :integer # created_at :datetime not null # updated_at :datetime not null # user_id :integer # status :string(...
true
a3f52a28787c698c51cbd578642cbed68345f1ee
Ruby
jonathansayer/chess
/app/services/convert_coordinates.rb
UTF-8
1,336
3.75
4
[]
no_license
class ConvertCoordinates @conversion_hash = {'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8 } def self.to_...
true
4ab0002797ddbe4901619e1b5a8b8fccf8271ccd
Ruby
ashcode09/takeaway-challenge
/lib/order.rb
UTF-8
579
3.015625
3
[]
no_license
require_relative 'checkout' class Order attr_accessor :order_list, :menu_list include Checkout def initialize @menu_list = {"Bottle of Water" => 3.08, "Disney Themed Napkins (x5)" => 50, "Carbonara" => 0.4, "Ice cream" => 0.48, "Happiness" => 0} @order_list = [] end def print_menu menu_list.each ...
true
92e650e2e45d23d15dcc9576c0ab49f4bd967188
Ruby
episodic/episodic-platform-ruby
/lib/episodic/platform/exceptions.rb
UTF-8
2,847
2.8125
3
[ "MIT" ]
permissive
module Episodic module Platform # # Abstract super class of all Episodic::Platform exceptions # class EpisodicPlatformException < StandardError end class FileUploadFailed < EpisodicPlatformException end # # An execption that is raised as a result of the response co...
true
5255c9fe5b035666202ab964065a601487d586e0
Ruby
falchek/headfirst_ruby
/chapter2/vehicle_methods.rb
UTF-8
750
3.65625
4
[]
no_license
# These methods are placed in the top-level execution environment # That means they're called without the dot operate. def accelerate puts "Stepping on the gas" puts "Speeding up!" end def sound_horn puts "Pressing the horn button" puts "Beep beep!" end def use_headlights(brightness = "low-beams") ...
true
084d03410ce78f5de48f343c0bff0c548252845c
Ruby
CariWest/udacity-projects
/rbnd-toycity-part1-master/lib/app.rb
UTF-8
3,494
3.625
4
[]
no_license
require 'json' path = File.join(File.dirname(__FILE__), '../data/products.json') file = File.read(path) products_hash = JSON.parse(file) # Print today's date puts "Today's Date: #{Time.now.strftime("%D")}" puts " _ _ " puts " | | | | " puts " _ __...
true
7a9b3892a1330d14a6b39c9ded4176afd40eb8c1
Ruby
AllPurposeName/ScriptHub
/load_task.rake
UTF-8
4,338
2.671875
3
[]
no_license
require 'faker' require "capybara/poltergeist" require 'pry' require 'launchy' desc "simulate load against HubStub app" task :load_test do 4.times.map { |i| Thread.new {Raker.new(i).new_users}; Thread.new {Raker.new(i).admin_surfing}; Thread.new {Raker.new(i).user_adventures}; Thread.new {Raker.new(i).add_random...
true
46db1b258082c5f08e8aa2ded5c0facefb80238f
Ruby
ARERA-it/inviti
/app/helpers/calendario_helper.rb
UTF-8
450
2.609375
3
[ "MIT" ]
permissive
module CalendarioHelper def cell_classes(cal_date) arr = [] arr << (cal_date.outer ? 'outer' : 'inner') arr << (cal_date.workday ? 'workday' : 'non_workday') arr << (cal_date.date==Date.today ? 'today' : nil) [:top, :bottom, :left, :right].each do |direction| arr << ("#{direction}_line" if ...
true
d1a1b8de9537f85e4a1c49bcbd994a58774b80ad
Ruby
blee2125/top-companies-y-combinator-cli-gem
/lib/top_yc_companies/scraper.rb
UTF-8
531
2.921875
3
[ "MIT" ]
permissive
class TopYcCompanies::Scraper #retrieves the website to scrape def list_page Nokogiri::HTML(open("https://www.ycombinator.com/topcompanies/")) end #scrape_page is responsible for scraping all of the company data def scrape_page self.list_page.css("tbody#main-companies tr") end #make_company...
true
96d1302a005be56dfcc028f3d370025eb2b2fa56
Ruby
mongodb/mongoid
/lib/mongoid/matcher/size.rb
UTF-8
1,377
2.84375
3
[ "MIT" ]
permissive
# rubocop:todo all module Mongoid module Matcher # In-memory matcher for $size expression. # # @see https://www.mongodb.com/docs/manual/reference/operator/query/size/ # # @api private module Size # Returns whether a value satisfies a $size expression. # # @param [ true | fa...
true
a41300165b0c37b69e12788c6713b0d3754c41b1
Ruby
LadyDianah/ruby_class
/class1.rb
UTF-8
118
2.875
3
[]
no_license
# prints out name puts "Iam Dianah" puts 2+5 def name() puts "enter your name" name=gets puts name end puts name()
true
38aac091b6083a990b3dc1e45cfb214ca04e455c
Ruby
henderea/epg_util
/lib/epg/plugin/stats.plugin.rb
UTF-8
4,617
2.734375
3
[ "MIT" ]
permissive
require 'everyday-plugins' include EverydayPlugins require 'everyday-cli-utils' EverydayCliUtils.import :histogram, :kmeans, :maputil require 'io/console' module EpgUtil class Stats extend Plugin register(:command, id: :path_stats, parent: :path, name: 'stats', aliases: %w(stat), short_desc: 'stats', desc: '...
true
dd0e37c20b6d2dbeff219d03714ad0160ddea058
Ruby
gprashanthkumar/examtracker
/vendor/plugins/harbinger-rails-extensions/plugin_utils.rb
UTF-8
2,209
2.875
3
[]
no_license
require 'fileutils' module PluginUtils class ResourceInstallation attr_reader :source def initialize(src, dest, opts = {}) @source = src @destination = dest @options = opts end def overwrites? @options[:overwrite] end def message @options[:message] end ...
true
b3357793130c394be889eaf11c7f9e518fb17109
Ruby
bother7/rails-project-mode-web-071717
/app/models/user_team.rb
UTF-8
1,741
2.796875
3
[ "MIT" ]
permissive
class UserTeam < ApplicationRecord has_many :player_user_teams has_many :players, through: :player_user_teams belongs_to :user, optional: true validates :name, presence:true, uniqueness: true validate :unique? validate :totalsalary def unique? self.errors[:players] << "need to be unique" if self.playe...
true
b1b236262031d66eaa17f5476b85e69237d2e911
Ruby
IdleScV/Notes
/MOD 1 Notes/ActiveRecord/intro_active_record.rb
UTF-8
2,654
3.125
3
[]
no_license
Things we need for active record to work.. #? Additional documentation... #* https://guides.rubyonrails.org/active_record_basics.html#update #* http://jamesponeal.github.io/projects/active-record-sheet.html in GEM sqlite // This is just a database. It can be any database #! rake //These are also neccesary #! active...
true
651fe2ca6fdb38816069e13bfa9218c074276a7a
Ruby
RxMz/Book-List-Scraper
/app/workers/report_worker.rb
UTF-8
921
2.6875
3
[]
no_license
class ReportWorker include Sidekiq::Worker sidekiq_options rety: true def perform(book_lists) data = string_generator(book_lists) return data end def string_generator(book_lists) entries = "" book_lists.each { |book_list| book_list.courses.each { |course| department = course.department cours...
true
f170ba13733838c91ec13d9b820d86b971c1e983
Ruby
DanM2010/ruby-challenges
/first_class_parent_child.rb
UTF-8
1,772
3.625
4
[]
no_license
class Match puts "Hello!" def set_date=(date) @date = date end def get_date return @date end def set_final_score=(final_score) @final_score = final_score end def get_final_score return @final_score end def set_home_team=(home_team) @home_team = home_team end def g...
true
389eaa19492dc66d9ee2810ff8b711331b85a948
Ruby
gokuhadi/RubyTraining
/ruby_project/iter.rb
UTF-8
116
3.296875
3
[]
no_license
#ary = [1,2,3,4,5] #ary.each do |i| # puts i #end #has = { a:1,b:2, c:3, d:4, e:5} #has.each { |k,v| puts k }
true
58b8d6e29661e263065788dcdaef616422c2b13c
Ruby
mkhoeini/kelasiTline
/spec/models/post_spec.rb
UTF-8
1,762
2.65625
3
[]
no_license
require "spec_helper" describe Post do before do @post = Post.create do |p| p.msg = "test message" end end it "Should have a parent" do p = Post.new parent_id: @post.id p.parent.should be_an_instance_of Post end it "Should have replies" do Post.create {|q| q.msg = 'reply'; q.parent_id = ...
true
c38049ddd12d1efced7876ebf2c0a36fd4531dde
Ruby
rodovich/inactive-record
/inactive_record/relation.rb
UTF-8
1,729
2.625
3
[]
no_license
module InactiveRecord class Relation def initialize(klass, params = {}) @klass = klass @params = params @params[:where] ||= [] @params[:order] ||= [] @params[:limit] ||= nil end # return a new relation, including the new `where` conditions def where(conditions) Rel...
true
7a247371cdaad241f5ef79baeaffac0d95b477b7
Ruby
mikowitz/rubypond
/test/sharp_test.rb
UTF-8
1,033
2.65625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require File.dirname(__FILE__) + "/test_helper" describe "Sharp" do before :each do @fs = Sharp.new(f) end it "#name should return the correct value" do @fs.name.should == "fs" end it "#offset should return the correct value" do @fs.offset.should == 6 end it "#natural_offest should r...
true
5977ebac5df301176b42a654043d2798fc1b0464
Ruby
curlywallst/ttt-with-ai-project-v-000
/lib/players/computer.rb
UTF-8
2,476
3.484375
3
[]
no_license
module Players class Computer < Player attr_accessor :move WIN_COMBINATIONS = [ [0,1,2], # Top row [3,4,5], # Middle row [6,7,8], # Bottom row [0,3,6], # Left column [1,4,7], # Middle column [2,5,8], # Right row [0,4,8], # First diagonal [2,4,6] # Second...
true
042b31f7512bb12632e4f6f2103711b8aee9356f
Ruby
rarayukawa/pro_ruby
/4.7.13.rb
UTF-8
1,048
3.359375
3
[]
no_license
#要素が5つで'default'を初期値とする配列を作成する a = Array.new(5, 'default') a #=> ["default", "default", "default", "default", "default"] #1番目の要素を取得する str = a[0] str #=> "default" #1番目の要素を大文字に変換する(破壊的変更) str.upcase! str #=> "DEFAULT" #配列の要素全てが大文字に変わってしまう a #=>["DEFAULT", "DEFAULT", "DEFAULT", "DEFAULT", "DEFAULT"] #ブロックを使って、ブロックの戻り...
true
934ec4767de94c9bf0ebe9f958bce27bef128a08
Ruby
jrupinski/app-academy
/rails/music_app/app/helpers/tracks_helper.rb
UTF-8
248
2.53125
3
[]
no_license
module TracksHelper def ugly_lyrics(lyrics) note_sign = '&#9835;' formatted_lyrics = '' lyrics.each_line do |line| formatted_lyrics << "#{note_sign} #{h(line)}" end "<pre>#{formatted_lyrics}</pre>".html_safe end end
true
e5d885eb33f7fc9a1810b82fb0e8070c435a3d08
Ruby
dorianwolf/math_game
/methods.rb
UTF-8
1,341
4.0625
4
[]
no_license
def begin_game # INITIALIZE puts "How many players will there be?" num_players = gets.chomp.to_i @players = [] @loser = nil # CREATE PLAYERS num_players.times do |num| @player = { name: "", health: 3, score: 0 } puts "What is the name of player #{num+1}?" @player[:name] = ge...
true
52f17b1b1e32d1d0e00ea282cddd8ffab3716081
Ruby
karlwitek/launch_school_rb120
/lesson4/hard1_prob3ls.rb
UTF-8
3,213
3.953125
4
[]
no_license
# Problem 3: Incorporate a new Motorboat class (1 hull, 1 propeller) and behaves similar to Catarmaran. # Create a new class to present the common elements of motorboats and catamarans. (Seacraft). We still # want to include the Moveable module to get support for calculating the range. module Moveable attr...
true
cf7ec7237e881ec423fc88cc201fc0ee4ddcb5fa
Ruby
tscholz/artifactory-gem_import
/lib/artifactory/gem_import/worker/importer.rb
UTF-8
3,979
2.625
3
[]
no_license
require "tmpdir" require "fileutils" module Artifactory module GemImport module Worker class Importer < Base attr_reader :source_repo, :target_repo, :only def initialize(source_repo:, target_repo:, only: /.+/) @source_repo = source_repo @target_repo = target_repo ...
true
941c302e1f1734b9d63a6c6f8bcd2d0d8ab17890
Ruby
mxenabled/firebolt
/lib/firebolt/file_warmer.rb
UTF-8
612
2.59375
3
[ "MIT" ]
permissive
require 'firebolt/warmer' module Firebolt class FileWarmer include ::Firebolt::Warmer def perform return nil unless cache_file_exists? parsed_contents end private def cache_file ::Firebolt.config.cache_file end def cache_file_exists? ::File.exists?(cache_file) ...
true
51309fc34b73bc140e0b1dc55901cbc4545e5b4a
Ruby
wesleyhuang23/programming-lessons
/ruby/4. redacted.rb
UTF-8
364
4.09375
4
[]
no_license
#Redacted puts "please type a response" text = gets.chomp puts "the word you want to redact" redacted = gets.chomp #split method - splits a string and returns an array words = text.split(" ") #each is kind of like each, map create new array in JS words.each do |word| if word == redacted print "REDACTED" ...
true
0b8d0c78170b0be05dc4bca2daf906e0f9748f16
Ruby
Beondel/key-for-min-value-001-prework-web
/key_for_min.rb
UTF-8
296
3.4375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# prereqs: iterators, hashes, conditional logic # Given a hash with numeric values, return the key for the smallest value def key_for_min_value(name_hash) low_key = nil name_hash.each_key { |key| low_key = key if low_key == nil || name_hash[key] < name_hash[low_key]} low_key end
true
2dc9d25fc86e612dc6e4fca3574d5c03a2da09c5
Ruby
lesniakania/social_network_analyser
/spec/social_network_analyser_spec.rb
UTF-8
3,997
2.65625
3
[]
no_license
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'social_network_analyser' require 'node' require 'edge' require 'graph' describe SocialNetworkAnalyser do before(:each) do @nodes = (0..4).map { |id| Node.new(id) } end describe "degree centrality" do it "should compute outdegree ...
true
852e50d70f093df3c3f44b940caa7a2b6636848d
Ruby
tkengo/meta_graph
/lib/meta_graph/collection.rb
UTF-8
741
3.109375
3
[]
no_license
module MetaGraph # # *Collection* class presents an array data in Facebook Graph API. # class Collection include GraphAccessor include Enumerable # # Create *Collection* instance from an array. # # === Arguments # [access_token] access token to read a data from Graph API. # ...
true
42efbf318d61af42161e77f9d03ede2152f1d8a9
Ruby
xuhui-github/rubydailyprogramming
/class/abstractgreeter.rb
UTF-8
318
3.078125
3
[]
no_license
class AbstractGreeter def greet puts "#{greeting} #{who}" end end class WorldGreeter <AbstractGreeter def greeting;"hello";end def who;"world";end end class SpanishGreeter <AbstractGreeter def greeting;"hola";end def who;"world";end end WorldGreeter.new.greet SpanishGreeter.new.greet
true
72b4b6dba26a9a050bc45f4a729a2461d8ebc91d
Ruby
AuthorizeNet/sample-code-ruby
/PaymentTransactions/charge-tokenized-credit-card.rb
UTF-8
2,768
2.546875
3
[ "MIT" ]
permissive
require 'rubygems' require 'yaml' require 'authorizenet' require 'securerandom' include AuthorizeNet::API def charge_tokenized_credit_card() config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml") transaction = Transaction.new(config['api_login_id'], config['api_transaction_k...
true
aa0e034e46bf117f8818e725b35b651410c25ea5
Ruby
chrbradley/population
/lib/analytics.rb
UTF-8
7,222
3.765625
4
[]
no_license
class Analytics attr_accessor :options, :m_id def initialize(areas) @areas = areas # => set @areas class variable to areas argument passed to Analytics.new set_options end def set_options @options = [] # => create an instance variable to hold a menu # => menu will be an array of hashes. Each ...
true
ff0e6b09f61d0ea239b5e02bf1deb4aa9cdb931a
Ruby
yuqiqian/ruby-leetcode
/94_BT_inorder_traversal.rb
UTF-8
318
3.1875
3
[]
no_license
def inorder_traversal(root) if root == nil return [] end stack = [root] current = root.left result = [] while stack.length != 0 || current!= nil while current!= nil stack << current current = current.left end current = stack.pop result << current.val current = current.right end result end
true
7facce8463cdd04c3b01e4ea7051ba431cb2c06d
Ruby
CedricBm/bergamotte-rails-coding-test
/test/models/item_test.rb
UTF-8
729
2.59375
3
[]
no_license
require 'test_helper' class ItemTest < ActiveSupport::TestCase test "sums the amount of item ordered" do paper = items(:paper) leather = items(:leather) assert_equal 5, paper.items_amount assert_equal 0, leather.items_amount end test "items has been ordered within the week timeframe" do ite...
true
f524c9983caf95cc951818bbf28bd558a3583609
Ruby
thejennywang/lockers
/spec/concierge_spec.rb
UTF-8
2,208
2.953125
3
[]
no_license
require 'concierge' require 'bag' require 'locker' describe 'Concierge' do let (:concierge) { Concierge.new } let (:small_bag) { double :small_bag, size: "small" } let (:medium_bag) { double :small_bag, size: "medium" } let (:large_bag) { double :small_bag, size: "large" } let (:all_available_lockers) ...
true
1eec4c3ed62083eb4f122cf043ea0af175c68a95
Ruby
deild/RubyOnRailsEtudeDeCas
/e1/views/app/models/picture.rb
UTF-8
696
2.578125
3
[ "MIT", "Apache-2.0" ]
permissive
#--- # Excerpted from "Ruby on Rails, 2nd Ed." # We make no guarantees that this code is fit for any purpose. # Visit http://www.editions-eyrolles.com/Livre/9782212120790/ for more book information. #--- class Picture < ActiveRecord::Base validates_format_of :content_type, :with => /^image/, ...
true
9c36cbf221a6d3d168c14595b812536b3be5412a
Ruby
DEFRA/waste-carriers-back-office
/app/services/reports/defra_quarterly_stats_service.rb
UTF-8
4,740
2.640625
3
[ "LicenseRef-scancode-unknown-license-reference", "OGL-UK-3.0" ]
permissive
# frozen_string_literal: true # This is a minimalist implementation to meet an urgent requirement. It is expected to be enhanced later. module Reports class DefraQuarterlyStatsService < ::WasteCarriersEngine::BaseService attr_reader :start_date, :end_date, :abandon_rate, :abandon_rate_percent # rubocop:disa...
true
dfe77aee8278a7d204d6ee5fef89ba466394ec6e
Ruby
MisterMur/globetrottr
/app/models/activity.rb
UTF-8
1,533
2.59375
3
[ "MIT" ]
permissive
class Activity < ApplicationRecord belongs_to :destination has_many :trip_activities has_many :trips, through: :trip_activities # before_action :connect_google_api GOOGLE_API_KEY= ENV['GOOGLE_API_KEY'] def location #check trip association --> there's no relationship yet self.destination.to_s end...
true
b49bca01cec406549d37a1254fb109174d4aaafc
Ruby
marcwright/WDI_ATL_1_Instructors
/REPO - DC - Students/w02/d03/Brett/gladiator/spec/arena_spec.rb
UTF-8
1,819
3.1875
3
[]
no_license
require_relative '../lib/arena' describe Arena do let (:arena) { Arena.new("colosseum") } describe "::new" do it "sets the arena's name and capitalizes" do expect( arena.name ).to eq "Colosseum" end end describe "#add_gladiator!" do it "adds a gladiator to the arena" do arena.add_gladia...
true
543f9ac21e8423791acd7d13b556a98c5c3b1ecc
Ruby
lcarrasco/CFDI
/lib/concepto.rb
UTF-8
1,539
3.0625
3
[ "WTFPL" ]
permissive
module CFDI # Un concepto del comprobante class Concepto < ElementoComprobante # @private @cadenaOriginal = [:cantidad, :unidad, :noIdentificacion, :descripcion, :valorUnitario, :importe] # @private attr_accessor *@cadenaOriginal # @private def cadena_original return [ ...
true
fb185371f6a0d5d05a290cdc904fa0b7f687cd13
Ruby
EMDevelop/battle
/lib/game.rb
UTF-8
237
3.40625
3
[]
no_license
class Game def initialize(player_one, player_two) @players = [player_one, player_two] end def player_one @players[0] end def player_two @players[1] end def attack(player) player.receive_damage end end
true
ed0223def905b86cec5a84ed40456a0adeeb38fb
Ruby
dasolari/platanus-challenge
/lib/views/game_view.rb
UTF-8
3,190
3.484375
3
[]
no_license
# frozen_string_literal: true require 'terminal-table' require_relative '../inputs' require_relative '../helpers/colorizer' # Singleton class in charge of the user interface and console prints class View @instance = new private_class_method :new class << self attr_reader :instance end def print_greet...
true
f65b78ee393c3c0b7064a9c06aabb3753a15ca1f
Ruby
pokutuna/btproject
/spec/log_parser_spec.rb
UTF-8
2,361
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- require 'spec_helper' require 'log_parser' describe Record, 'when parsing log data' do before(:all) do @sample1 = '2009/11/10 10:39:12 pokutuna-ThinkPad 00:19:7E:F6:F5:5D' @sample2 = '2009/11/20 17:8:0 00:22:F3:9C:37:D8' @sample3 = '2009/11/20 17:10:0 hoge-pc 00:1B:DC:00:04:18' ...
true
bc9e0ba98ae41aaa4018ef2486aa1d328c0bb6ac
Ruby
SwtCharlie/Quick-Testing
/hlrb/killing.rb
UTF-8
192
2.640625
3
[]
no_license
homicide = Thread.new do while (1 == 1) puts "Don't kill me!" Thread.pass end end suicide = Thread.new do puts "This is all meaningless!" Thread.exit end Thread.kill(homicide)
true
f7af7a9cdda523171369b0d210c0225426c32dc2
Ruby
panickat/CodeaCampRuby
/sem4/dia1/2_publicovs_privado.rb
UTF-8
4,142
4.09375
4
[]
no_license
=begin Público Vs Privado El concepto de público y privado es muy importante dentro de un programa diseñado bajo el paradigma de OOP. Un objeto se compone de información y de métodos. Depende de como diseñes el objeto, si estos son públicos o privados. Es importante que un objeto solamente exponga lo indispensable y...
true
39cfae8ad8e304a48bde7db762c5fbaa6363621f
Ruby
deild/RubyOnRailsEtudeDeCas
/e1/depot_ws/app/controllers/login_controller.rb
UTF-8
2,362
2.875
3
[ "MIT" ]
permissive
#--- # Excerpted from "Ruby on Rails, 2nd Ed." # We make no guarantees that this code is fit for any purpose. # Visit http://www.editions-eyrolles.com/Livre/9782212120790/ for more book information. #--- # This controller performs double duty. It contains the # #login action, which is used to log in administrative use...
true
04bee5ccee9d168815dd128d07bc2df03582845b
Ruby
yuuki920/freemarket_sample_75b
/app/models/address.rb
UTF-8
1,194
2.59375
3
[]
no_license
class Address < ApplicationRecord belongs_to :user validates :first_name, presence: true, format:{ with: /\A[ぁ-んァ-ン一-龥]/ } validates :last_name, presence: true, format:{ with: /\A...
true
d17ffd144a7694724aaf35bd3186540ada3b67db
Ruby
rattle/diffrenderer
/lib/word_run_diff_lcs.rb
UTF-8
1,398
2.859375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module WordRunDiffLCS class WordRunContextChange attr_reader :action, :old_element, :new_element def initialize(change_context) @action = change_context.action @old_element = change_context.old_element @new_element = change_context.new_element end def merge!(change_context) ...
true
48ee77ee465bca06bbf270c62610e7946efd3554
Ruby
karlwitek/launch_school_rb130
/ruby_foundations_exer/easy2/each_with_index.rb
UTF-8
1,585
4.5625
5
[]
no_license
# The Enumerable#each_with_index method iterates over the members of a collection, passing # each element and its index to the associated block. The value returned by the block is not used. # #each_with_index returns a reference to the original collection. # Write a method called each_with_index that behaves similar...
true
fa38916b1d524e2230026365b71f5e518a91a60f
Ruby
Dwire/jukebox-cli-prework
/lib/jukebox.rb
UTF-8
1,444
3.609375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
songs = [ "Phoenix - 1901", "Tokyo Police Club - Wait Up", "Sufjan Stevens - Too Much", "The Naked and the Famous - Young Blood", "(Far From) Home - Tiga", "The Cults - Abducted", "Phoenix - Consolation Prizes", "Harry Chapin - Cats in the Cradle", "Amos Lee - Keep It Loose, Keep It Tight" ] # def s...
true
eaeee48f94eea66f28802828aa4080d26b2efdc5
Ruby
Videmor/TestingRoR
/clase2/non_duplicate_values/lib/non_duplicate_values.rb
UTF-8
61
2.84375
3
[]
no_license
def non_duplicate(ar) ar.select{|v| ar.count(v) == 1} end
true
bd74c767cf4868510faf1ffef3af4ed74497dc81
Ruby
danclark1820/TDD_challange
/taxes/taxes.rb
UTF-8
801
3.359375
3
[]
no_license
require 'csv' require 'pry' class Citizen attr_reader :first_name, :last_name, :annual_income, :tax_paid, :tax_rate def initialize(first_name, last_name, annual_income, tax_paid, tax_rate) @first_name = first_name @last_name = last_name @annual_income = annual_income @tax_paid = tax_paid @tax...
true
3427b476b13c7f3dc8244011537c6aee9627afa9
Ruby
NicholasRostov/object_oriented_ruby
/store_item.rb
UTF-8
430
3.078125
3
[]
no_license
# Some of your store items are food, which have a shelf life. Create a class called Food which inherits from your original class and has an additional property of shelf_life. captain_munch = {sugar_content: "24mlg", color: "Purple", milk_fusion: "mild"} cinnamon_waffle = { :sugar_content => "50mlg", :color => "Brown",...
true
f1ff0b27059906c4b05e3b0d4354c571d1845889
Ruby
Fish-bowl/garbage_80s_game
/ex15.rb
UTF-8
493
3.453125
3
[]
no_license
#this line creates and crequires an argument ie. filename filename = ARGV.first #opens txt doc specified by user input "filename" txt = open(filename) #prints note and user input puts "Here's your file #{filename}:" #prints user selected txt. doc print txt.read #re asks for filename print "Type the filename again: " #c...
true
2f1ce0ea259e1f94fda980f009dc202a4950676b
Ruby
aniagonzalez/tunes-takeout
/app/controllers/suggestions_controller.rb
UTF-8
3,240
2.8125
3
[]
no_license
require_relative '../../lib/TunesTakeoutWrapper.rb' require 'yelp' require 'httparty' class SuggestionsController < ApplicationController #skip before action def index #shows top 20 suggestions, ranked by total number of favorites suggestion_ids = TunesTakeoutWrapper.top["suggestions"] #this should return a...
true
3331839229efa8594398122b6e6789ef896ab1f3
Ruby
timothyekl/web-oneshot
/wos.rb
UTF-8
3,807
2.8125
3
[]
no_license
#!/usr/bin/env ruby require 'base64' require 'optparse' require 'pp' require 'socket' PBAR_AVAILABLE = require 'progressbar' @options = {} DEFAULT_PORT = 8080 CHUNK_SIZE = 4096 module Helpers # Define loggers def log_verbose(s) if @options[:verbose] == true puts s end end def result(status, so...
true
70afeb30aa9b1c7e9ee6da66cf091b1be3c2a670
Ruby
lovebread/iyxzone_my
/vendor/plugins/acts_as_rateable/lib/acts_as_rateable.rb
UTF-8
870
2.546875
3
[ "MIT" ]
permissive
# ActsAsRateable # the origin plugin is out-of-date and is full of some useless methods # author: 高毛 module Rateable def self.included(base) base.extend(ClassMethods) end module ClassMethods def acts_as_rateable opts={} has_many :ratings, :as => 'rateable', :dependent => :destroy include Ra...
true
23178373a498ce927980ff4cd4f26fc56583ee40
Ruby
fuCtor/london-bot
/lib/report_downloader.rb
UTF-8
562
2.734375
3
[]
no_license
class ReportDownloader attr_reader :url require 'open-uri' require 'net/http' def initialize(url) @url = url end def download(target) uri = get_file_uri FileUtils.mkdir_p File.dirname(target) Net::HTTP.start(uri.host) do |http| resp = http.get(uri.path) open(target, "wb") do |...
true
c6b07f1d78bcb916b7b400926bf75d46c67367f5
Ruby
teja318/ecommerce
/faker.rb
UTF-8
396
2.546875
3
[]
no_license
require 'faker' 10.times do category = Category.new({"name" => Faker::Commerce.department(1)}) category.save end 50.times do product = Product.new({"name" => Faker::Commerce.product_name, "price" => Faker::Commerce.price(50..10000), "description" => Faker::Lorem.sentence, "category_id" => Category.all.sa...
true
90cb19b39179aea1a0d5427cac568de00b3b77ef
Ruby
GenerationThree/zhangsiyue-rich-ruby
/lib/player.rb
UTF-8
293
2.859375
3
[]
no_license
class Player @status @last_executed def execute(command) @last_executed = command @status = command.execute(self) end def respond(response) @status = response.execute(self) end def get_status @status end def get_last_executed @last_executed end end
true
7c4104a73cc13f19fa3f08c733507d266a47f523
Ruby
NikolaiIvanov/catstars
/test/lib/place_bid_test.rb
UTF-8
838
2.671875
3
[ "MIT" ]
permissive
require "test_helper" require "place_bid" class PlaceBidTest < MiniTest::Test def setup @user = User.create! email: "test@test.com", password: "password" @other_user = User.create! email: "test1@test.com", password: "password" @cat = Cat.create! name: "Awesome cat" @auction = Auction....
true
f5759725c7398768c3defd4d458222457df7e43b
Ruby
davidcelis/ostatus
/lib/ostatus/entry.rb
UTF-8
2,455
2.5625
3
[]
no_license
require_relative 'activity' require_relative 'author' require_relative 'thread' require_relative 'link' module OStatus THREAD_NS = 'http://purl.org/syndication/thread/1.0' # Holds information about an individual entry in the Feed. class Entry < Atom::Entry include Atom::SimpleExtensions add_extension_n...
true
d036233f1570eb9273cce4181fb6540caece5283
Ruby
fbongiovanni29/ruby_basics
/wrkshp.rb
UTF-8
412
4.0625
4
[]
no_license
def america(x) puts x + "Only in America!" end puts america("Cheesebugers are "); nuArray = [1, 3, 2] organized_array = nuArray.sort puts organized_array def max_num(n) n.sort puts n[n.length - 1] end n = [2, 3, 1, 6, 7] max_num(n) def cars(make, model) car = {make[0] => model[0], make[1] => model[1]} end ...
true
a930bb0952b39d326c9421578e9c35850e13c94e
Ruby
mmbensalah/scrabble_web_api
/spec/requests/games_request_spec.rb
UTF-8
1,327
2.90625
3
[]
no_license
require "rails_helper" describe "Games API" do # it "returns all games" do # josh = User.create(id: 1, name: "Josh") # sal = User.create(id: 2, name: "Sal") # # game = Game.create(id: 1, player_1: josh, player_2: sal) # # get "/api/v1/games/1" # # expect(response).to be_successful # gam...
true
287a023cd49ac168504cc9e20410a38178df1166
Ruby
KevinNorth/Kevbot
/src/commands/nsfw.rb
UTF-8
2,092
3.046875
3
[ "MIT" ]
permissive
require_relative '../kevbot_state.rb' require_relative 'command.rb' class NsfwCommand include Command # Returns an array of strings that can be used as command names in the chat. def names() names = [] names.push "nsfw" return names end # execute(string) - return nothing # Submits a complaint t...
true
46dedca4039d1f668bb4c98b5ba0b8b07fb2e517
Ruby
DMscotifer/wk2_day1_homework
/partBhomework.rb
UTF-8
696
3.125
3
[]
no_license
class Sports_Team attr_accessor :team_name, :player_names, :coach, :points def initialize(team_name, player_names, coach, points) @team_name = team_name @player_names = player_names @coach = coach @points = points end # # def get_team_name # @team_name = team_name # end # # def get_player_names...
true
bf83576d7c6527cf38c8fd9d40f9dfed21e9b7b9
Ruby
alejandracampero/ttt-7-valid-move-bootcamp-prep-000
/lib/valid_move.rb
UTF-8
485
3.6875
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# code your #valid_move? method here board = [" ", " ", " ", " ", " ", " ", " ", " ", " "] def valid_move? (board, index) if index.between?(0,8) && position_taken?(board, index) == false true end end # re-define your #position_taken? method here, so that you can use it in the #valid_move? method above. def ...
true
4187282b8d7b1b543387293285f8d1b68ad40d85
Ruby
stef-codes/ruby-enumerables-hash-practice-green-grocer-lab-online-web-prework
/grocer.rb
UTF-8
1,269
3.21875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def consolidate_cart(cart) cart_hash = {} count = 0 cart.map do |element| element.each do |fruit,hash| cart_hash[fruit] ||= hash cart_hash[fruit][:count] ||= 0 cart_hash[fruit][:count] += 1 end end cart_hash end def apply_coupons(cart, coupons) coupons.each do |coupon| item = coupo...
true
096cc467e7dee1266c3f68b00653ba07577b1aa7
Ruby
colinrubbert/course_work
/firehose/prework/ch4/inches.rb
UTF-8
120
3.640625
4
[]
no_license
puts "Enter a legth in inches" inches = gets.chomp cent = inches.to_f * 2.54 puts "#{inches} is #{cent} in centimeters."
true
294ee2189b7f210f812a641e79ca58a25e9882d4
Ruby
ChengHsuanLiu/FastekReport
/parser/annual_report_generator.rb
UTF-8
5,655
2.90625
3
[]
no_license
########################## ## 年度業績報表 ########################## ## 使用方法 ## 呼叫程式,後面帶參數譬如 2016.csv, 2017.csv, ## 每個檔案是該年度的年度進銷報表 ## ex. ruby parser/annual_report_generator.rb 2016.csv 2017.csv ## 產品分類 # E 電動缸 / 音圈馬達 # K 光電類 # I 點膠類 # P 馬達 Hanmark / TOYO / DELTA # L 光寶 # 分公司 # 桃園總公司 # 台北:光鈦-台北 # 中壢:光鈦-中壢 # 新竹:光鈦-(竹鈦) ...
true
c174eee113ccd3ccfc83a82b5c185f39272a3195
Ruby
rentes/design_patterns_in_ruby
/Structural/Facade/facade.rb
UTF-8
896
3.4375
3
[ "MIT" ]
permissive
# The Subsystem Class A class class CarModel def model puts ' CarModel - model' end end # The Subsystem Class B class class CarEngine def engine puts ' CarEngine - engine' end end # The Subsystem Class C class class CarBody def body puts ' CarBody - body' end end # The Subsystem Class D class...
true
9a3fb26b97a85b72b8c1a91d6a1b89074fa31367
Ruby
pranavnawathe/DesignPatternsNew
/ruby/Proxy/movie_player.rb
UTF-8
381
3.046875
3
[]
no_license
#this class acts as Proxy require_relative 'video_functions' class MoviePlayer < VideoFunctions attr_accessor :movie attr_accessor :name def initialize(name) @movie = Movie.new(name) end def playMovie movie.playMovie end def getMovieDetails movie.getMovieDetails end ...
true
021c25e8a27dcd4eef7787fd3ee072f21f9994b6
Ruby
J-Y/RubyQuiz
/ruby_quiz/quiz98_sols/solutions/benchmark/proof.rb
UTF-8
396
3.484375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby -w require "sorted_array" # Daniel's PriorityQueue require "heap" # pure Ruby Heap, from Ruby Quiz #40 DATA = Array.new(5_000) { rand(5_000) }.freeze queue1, queue2 = PriorityQueue.new, Heap.new DATA.each do |n| queue1.add(n, n) queue2.insert(n) end until queue1.empty? raise "Mis...
true
ca6655f157bf47166bf32676bdda5a7ac5d62a6f
Ruby
kibex92/Pocket-Reader
/lib/services/reader_scraper.rb
UTF-8
1,613
2.890625
3
[]
no_license
require 'open-uri' require 'nokogiri' class ReaderScraper attr_reader :post_path URL = "https://dev.to/" def initialize(post_path) @post_path = post_path @posts_view = PostsView.new end def call post = scrape_post author = scrape_author { post: post, author: author } end private ...
true
df5548911c9fda84769cf7e2d220c4066754f5cb
Ruby
jKwibe/backend_module_0_capstone
/day_7/checker_board.rb
UTF-8
764
3.859375
4
[]
no_license
## Better Way => Dynamic Solution class CheckerBoard def checker_board(board_size) puts "Checker Board" x_columns = [] space_columns =[] i = 0 j = 0 # pushing values to the x_columns and space_columns arrays until i == board_size i += 1 if i.odd? #The same as if i...
true
59cb208a3e869397b61d5ebb12b825b698ae41b6
Ruby
odsod/gb
/scripts/generate-disassembler
UTF-8
9,306
2.515625
3
[]
no_license
#!/usr/bin/env ruby require 'json' require 'open3' class LD def initialize(i) @opcode = i['opcode'] @mnemonic, @cycles = i['implementation'].values_at('mnemonic', 'cycles') end def load_value case @mnemonic when /,\((a8|C)\)$/ # Zero page "value := cpu.memory.Read(mmu.ZeroPage.AddressOf(c...
true
7bc2ca54b214f1d0c650209229883700bf7ceca7
Ruby
mdonagh/ruby-intro
/1.rb
UTF-8
2,264
4.5
4
[]
no_license
# Your assignment is to use the examples below to write a method called "double" which takes an integer parameter # Double it, and return the doubled value. # Then write a test confirming the method works. # Also write a method called add_five with return value and two tests. # Also let me say - I know that there are...
true
c9d2e3a09d326300ee61003f93d25bc5004b3578
Ruby
pickledyamsman/prime-ruby-v-000
/prime.rb
UTF-8
129
3.546875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def prime?(int) divs = [] (1..int).to_a.each do |i| divs << i if int % i == 0 end divs.length == 2 ? true : false end
true