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
7081e392347e8d59538254d5823b3fba72ba95ab
Ruby
whatalnk/cpsubmissions
/atcoder/ruby/abc125/abc125_b/5146791.rb
UTF-8
419
3.125
3
[]
no_license
# Contest ID: abc125 # Problem ID: abc125_b ( https://atcoder.jp/contests/abc125/tasks/abc125_b ) # Title: B. Resale # Language: Ruby (2.3.3) # Submitted: 2019-04-27 12:17:19 +0000 UTC ( https://atcoder.jp/contests/abc125/submissions/5146791 ) n = gets.chomp.to_i v = gets.chomp.split(" ").map(&:to_i) c = gets.chomp.s...
true
48e17b15aeb1c6620e0e12f6b450612865e9a9af
Ruby
jeremysklarsky/metacritic
/lib/metacritic/Game.rb
UTF-8
614
2.609375
3
[ "MIT" ]
permissive
module Metacritic class Game attr_accessor :response def initialize(response) @response = response.body["result"] end def name @response["name"] end def score @response["score"].to_i end def rlsdate @response["rlsdate"] end def genre @r...
true
317afc038d119d3a4c693a1b3636ae057f7b035f
Ruby
exAspArk/vx-web
/lib/server_side_event_loop.rb
UTF-8
2,569
2.671875
3
[]
no_license
require 'json' require 'thread' class ServerSideEventLoop @@mutex = Mutex.new @@shutdown = false class << self def consumer unless @consumer @@mutex.synchronize do unless @consumer Rails.logger.debug " --> boot ServerSideEventsConsumer" @consumer = ServerS...
true
372a25d138e1f6b19feddfb9ebb11877100bf7f3
Ruby
ylafrance/scranky-chron
/main.rb
UTF-8
6,314
2.875
3
[]
no_license
# main.rb ## class MyApp ## def call(env) ## [200, {"Content-Type" => "text/html"}, ["Hello Rack Participants from across the globe"]] ## end ## end class HelloWorldApp def call(env) # env['HTTP_ACCEPT'] = 'application/json' response = Rack::Response.new # response.write ['Hello World (write)'] # ...
true
3381706c0d4eea4bbf3a88da95009042d4f5636f
Ruby
saadbinakhlaq/algorithms_in_ruby
/sort/insertion_sort.rb
UTF-8
676
4
4
[]
no_license
def insertion_sort_1(array) final = [array.shift] for i in array final_index = 0 while final_index < final.length if i <= final[final_index] final.insert(final_index, i) break elsif final_index == final.length - 1 final.insert(final_index + 1, i) break end...
true
cd56ddf866cb9cac344bd6ceb9d370fdbf0766ac
Ruby
snowmi/AOJ
/Problems/ITP1/ITP1_3_D.rb
UTF-8
123
3.234375
3
[]
no_license
a, b, c = gets.chomp.split.map(&:to_i) sum = 0 for i in a..b div = c % i if div == 0 sum += 1 end end puts sum
true
bacc622f12b27b402a731ed8edc55ba5fa38078d
Ruby
marcelitayestrellitas/introduccion_ruby
/ahorcado/generador_palabras.rb
UTF-8
441
2.84375
3
[]
no_license
require 'Faker' class GeneradorPalabras #creamos un método que sea dueño de la clase def self.generar_palabra_estatica palabras_secretas = ["hola", "adios", "teams", "programación", "ruby", "windows", "ubuntu", "css", ""] posicion_al_azar = rand(0..palabras_secretas.length-1) return pa...
true
87af94393ea23a537055af99a86d17217aa7f465
Ruby
caseyokay/advanced-hashes-hashketball-nyc01-seng-ft-091420
/hashketball.rb
UTF-8
6,395
3.5625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code below game_hash require "pry" def game_hash { home: { team_name: "Brooklyn Nets", colors: ["Black", "White"], players: [ { player_name: "Alan Anderson", number: 0, shoe: 16, points: 22, rebounds: 12, assists: 1...
true
c3b513ee376f3b1b97b7a635046dd5c7ca412f8d
Ruby
jrochkind/html_aware_truncation
/spec/html_aware_truncation_spec.rb
UTF-8
2,303
2.78125
3
[ "MIT" ]
permissive
require "spec_helper" RSpec.describe HtmlAwareTruncation do include HtmlAwareTruncation it "has a version number" do expect(HtmlAwareTruncation::VERSION).not_to be nil end describe "#truncate_html" do let(:short_text) { "<p>Foo! <b>Bar</b> Baz</p>" } let(:long_text) { "<p>Foo " + ("<b>Bar Baz</...
true
aad0daf164efee8c3141db26b747b2f3ea13166c
Ruby
asulovar/gact
/ANN_allele_prediction.rb
UTF-8
8,459
3.03125
3
[]
no_license
#!/usr/bin/env ruby ######################################################################### # Arvis Sulovari - April 4th Pedicts Allele type using a Feed-forward Backpropagation neural network ######################################################################### require 'rubygems' require 'ai4r' net_1 = Ai4r:...
true
91fbb76a179a11ccd24c3668be95877708385d2d
Ruby
Lightspeed-Systems/clever-ruby
/lib/clever-ruby/api_resource.rb
UTF-8
5,483
3.0625
3
[ "Apache-2.0", "MIT" ]
permissive
module Clever # Superclass of API resources in the Clever API. API objects are to be # singular, not plural; as in class Student, for the /students endpoint. class APIResource < CleverObject @resources = [] class << self # Get valid API resources # @api private # @return [Array] List of...
true
b591ee648a78ab8f61399119d062e5872cbe1d6a
Ruby
taleh007/rubyconf_game
/2018/db.rb
UTF-8
2,149
2.546875
3
[]
no_license
require 'rubygems' require 'bundler/setup' Bundler.require(:default) require_relative 'mega_db' DB_WATIR = Sequel.sqlite(database: 'watir.db') DB_YOUTUBE = Sequel.sqlite(database: 'youtube.db') DB_ERRORS = Sequel.sqlite(database: 'errors.db') _mega = MegaDB.new _e = DB_ERRORS[:errors] _t = DB_WATIR[:tasks] def save_...
true
964278d4d085123a64f2cb0d8cc1aa2c2ee1d839
Ruby
amyhliao/crime-fighter
/viewer.rb
UTF-8
2,907
2.65625
3
[ "MIT" ]
permissive
class View def initialize() end def display(string) puts string end def welcome_message puts "Welcome to 'Crime'fighter!!!" end def username_input puts "Please enter a crimefighter name..." end def ask_for_location puts "Please provide your current location..." end def ask_f...
true
6e8337da40ee274348c764a7ec645a006fb288c7
Ruby
itggot-robin-ortenfelt/webbserverprojekt-blogg
/app.rb
UTF-8
3,169
2.53125
3
[]
no_license
require 'sinatra' require 'slim' require 'sqlite3' require 'byebug' enable :sessions require 'bcrypt' get('/')do slim(:index) end get('/login') do slim(:login) end post ('/login') do db = SQLite3::Database.new('db/bloggDatabase.db') db.results_as_hash = true result = db.execute("SELECT username,...
true
b8551924e908cf2bd357f7fbaa64730f47fb978d
Ruby
fguillen/FibberMailman
/lib/fibber_mailman.rb
UTF-8
1,304
3.203125
3
[ "MIT" ]
permissive
require 'net/pop' class FibberPop def initialize( raw_mail) @raw_mail = raw_mail end def pop return @raw_mail end def method_missing(m, *args, &block) puts "PopMock.#{m} called" end end # # Example of use: # raw_mails = [ # File.read( "/fixtures/mail1.raw_mail" ) ), # ...
true
0d8b6b40c0cf8e92ef4e8919c1c9687249fbbdaf
Ruby
Ka1ex/programming-univbasics-nds-nds-to-insight-understand-lab-seattle-web-012720
/lib/nds_explore.rb
UTF-8
459
2.875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
$LOAD_PATH.unshift(File.dirname(__FILE__)) require 'directors_database' # Call the method directors_database to retrieve the NDS def pretty_print_nds(nds) # Change the code below to pretty print the nds with pp pp directors_database end def print_first_directors_movie_titles counter = 0 titles = [] while di...
true
6c3612f3e91c8a1434a61bee35ce469b71ea26f5
Ruby
socrata-platform/socrata-snapper
/lib/snapper.rb
UTF-8
3,388
2.96875
3
[]
no_license
require 'nokogiri' require 'selenium-webdriver' require_relative 'snapper_compare' require_relative 'snapper_error_check' require_relative 'snapper_page_finder' require_relative 'utils' # Class that drives the processing of commands to the library class Snapper attr_accessor :sites @sites # initialize the class...
true
9951ba32d7fe765bba7b9a1aa79101d3858dd0ba
Ruby
jacobmendoza/mcavoy
/api/models/news_report_summary_model.rb
UTF-8
726
2.78125
3
[]
no_license
# Represents a model of a news report class NewsReportSummaryModel attr_accessor :id, :id_str, :created_at, :source_created_at, :user_id, :user_name, :retweet_count, :favorite_count, :severity_label def initialize(tweet) @id = tweet.id @id_str = tweet.id.to_s @created_at = tweet.created...
true
2eac7c48eacb4073555f5aab2b315c9d361f0411
Ruby
Phoboes/WDi23-Homework
/joshua_mcevoy/week_04/day_01/Ruby/calculator.rb
UTF-8
2,930
4.65625
5
[]
no_license
# You will be building a calculator. A calculator can perform multiple arithmetic operations. Your function should allow the user to choose which operation is expected, enter in the values to perform the operation on, and ultimately view the result. # ###Specification: # # A user should be given a menu of operations # ...
true
b190d65b77d127c4f3f352611e7ab6365979c36d
Ruby
Qew7/andrew-game
/game.rb
UTF-8
10,491
2.71875
3
[]
no_license
CLASSES = { warrior: { str: 15, agi: 10, sta: 15, int: 5 }, rogue: { str: 10, agi: 15, sta: 10, int: 5 }, mage: { str: 5, agi: 5, sta: 10, int: 20 } } IMPROVED_CLASSES = { warrior: { barbarian: { str: 20, agi: 15, sta: 20, int: 5 }, paladin: { str: 15, agi: 15, sta: 20, int: 15 } }, rogue: { th...
true
b1e95b69ae635463a3aa0800100859b10e036b0d
Ruby
codef-io/easycodefrb-exam
/07_product/main.rb
UTF-8
1,193
2.578125
3
[]
no_license
require 'easycodefrb' demo_client_id = '' demo_client_secret = '' client_id = '' client_secret = '' public_key = '' # 코드에프 인스턴스 생성 codef = EasyCodef::Codef.new(public_key) # 데모 클라이언트 정보 설정 # - 데모 서비스 가입 후 코드에프 홈페이지에 확인 가능(https://codef.io/#/account/keys) # - 데모 서비스로 상품 조회 요청시 필수 입력 항목 codef.set_client_info_for...
true
c0cbf9ea7aba101106ca260fe9edd8e9b044dbe0
Ruby
smathy/grep
/test/grep.rb
UTF-8
444
2.515625
3
[]
no_license
require "test/unit" DIR = File.dirname(__FILE__) require File.join(DIR, '..', 'lib', 'grep') T = File.join( DIR, 'data') class Grep < Test::Unit::TestCase def setup @dir = Dir.open(T) end def test_dir_grep m = @dir.grep(/foobar/) assert_equal 2, m.size assert_equal 4, m.find{|e|e[:file] == './...
true
2350f47902368009de32738fa7c4a0c4f71a4e81
Ruby
yowasou/prisonardilemma
/lib/app.rb
UTF-8
1,318
3.3125
3
[]
no_license
class Plugin def Plugin.load(path) plugin = new() plugin.instance_eval File.read(path) plugin end def get_instance @instance end end def release(prisonar1, prisonar2) result = (0..9).to_a score = [0, 0] round = 0 prisonar1_before_answer = 0 prisonar2_before_answer = 0 ...
true
912856153b850e242a526713d82a2cbd897c304c
Ruby
appsignal/appsignal-ruby
/spec/lib/appsignal/event_formatter_spec.rb
UTF-8
6,182
2.859375
3
[ "MIT" ]
permissive
class MockFormatter < Appsignal::EventFormatter attr_reader :body def initialize super @body = "some value" end def format(_payload) ["title", body] end end class MockFormatterDouble < MockFormatter end class MissingFormatMockFormatter end class IncorrectFormatMockFormatter < Appsignal::Event...
true
6762375b66181973b11e145f23ca4d951e77532f
Ruby
maggiflux/patrones_ciclos
/patron4.rb
UTF-8
124
3.515625
4
[]
no_license
nums = ARGV[0].to_i (0...nums).each do|num| if num%3==0 print '1' elsif num%3==1 print '2' else print '3' end end puts
true
0e28101e5081cab65b1a522d678fb1f374585828
Ruby
ajshemi/ruby-advanced-class-methods-lab-dumbo-web-111819
/lib/song.rb
UTF-8
1,323
3.15625
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Song attr_accessor :name,:artist_name @@all = [] def self.all @@all end def initialize(options={}) @name= options[:name] || nil @artist_name=options[:artist_name] || nil end def self.create Song.new.save @@all.last end def self.new_by_name(name) Song.new(name: nam...
true
708e30f42bbc5d42b2d39eeaef673433c6d56e75
Ruby
enalihai/backend_mod_1_prework
/section2/exercises/ex30.rb
UTF-8
1,374
4.40625
4
[]
no_license
# Sets variable people to 30 people = 30 # Sets variable cars to 40 cars = 40 # Sets variable trucks to 15 trucks = 15 # if method with a boolean variable if cars > people # if line 9 is true, print statement puts "We should take the cars." # otherwise, if boolean is true, print statement elsif cars < people # Print...
true
51584256410055897e27af212ea7a76cef37b47e
Ruby
bdetwiller/checkers
/checkers.rb
UTF-8
1,554
3.765625
4
[]
no_license
require 'colorize' require 'debugger' require './piece.rb' require './board.rb' # coding: utf-8 class Game attr_reader :board, :current_player def initialize @players = { :red => Player.new( :red), :black => Player.new( :black) } @board = Board.new @current_player = :red end def ...
true
0c04ef23fdb029428e48a13c75ceed0bb483c407
Ruby
GonchuB/locatable
/db/seeds.rb
UTF-8
2,413
3.21875
3
[]
no_license
def fake_name Forgery("name").first_name + " " + Forgery("name").last_name.first + "." end def minutes_until_assign(since) since + Forgery(:basic).number(at_least: 1, at_most: 10).minutes end def minutes_until_check(since) minutes_until_assign(since) + Forgery(:basic).number(at_least: 30, at_most: 60).minutes e...
true
fd33ee6d4e65d0cde60d3c8469632de5fd7f0f79
Ruby
champagnepappi/ruby
/factorial.rb
UTF-8
221
3.375
3
[]
no_license
#longer way def factorial_sum(arr) result = arr.map {|i| factorial(i) } result.sum end def factorial(n) n<=0 ? 1 : n*factorial(n-1) end #refactored def sum_factorial(arr) arr.map {|i| (1..i).reduce(:*)}.sum end
true
70ff4183868dd30e5ac8587a079d1fdf463fd8c6
Ruby
iconara/stern
/lib/stern/protocol/broker.rb
UTF-8
503
2.765625
3
[]
no_license
module Stern module Protocol class Broker include Utils::FnvHash attr_reader :node_id, :host, :port def initialize(node_id, host, port) @node_id = node_id @host = host @port = port end def eql?(other) !other.nil? && @node_id.eql?(other.node_id) && @...
true
ce5626b43c925b82a7a9dae7e61ca7e684447f3e
Ruby
douglasfelipebs/ruby_puro_onebitcode
/aula_3/desafios/calc.rb
UTF-8
795
3.890625
4
[]
no_license
result = '' loop do if result != '' puts "O resultado é #{result}" end puts 'Selecione a operação desejada' puts '1- (+) Adição' puts '2- (-) Subtração' puts '3- (*) Multiplicação' puts '4- (/) Divisão' puts '0- Sair' print 'Opção: ' option = gets.chomp.to_i if opti...
true
025dd05a024dc254ae9d0063255211f3f03a477b
Ruby
owlbytes/F3
/spec/controllers/flats_controller_spec.rb
UTF-8
1,372
2.671875
3
[]
no_license
require 'spec_helper' describe FlatsController do # making sure a basic test will pass it "should pass" do true end it "should fail" do false end describe "GET #index" do #creating fake data to test the index method. before do @flat_fake_data = 5.times.map{ Flat.create(name: "...
true
eb8bfc130eb0e9cdb864fed3b4c5579d26e4a6ff
Ruby
turnon/tool
/chk_encode
UTF-8
165
2.859375
3
[]
no_license
#!/usr/bin/env ruby until ARGV.empty? f = ARGV.shift lines = File.readlines f puts "#{lines.any?{|l| l.chars.length != l.bytes.length} ? 'X' : ' '} #{f}" end
true
190b4f728849cd822dec25ae8773def0b6aca452
Ruby
eric-an/deepseakayaks
/spec/models/comment_spec.rb
UTF-8
898
2.53125
3
[]
no_license
require 'rails_helper' describe Comment do context "when the comment is fully filled out" do before do @comment = FactoryGirl.create(:comment) end it "should return an valid comment entry" do expect(@comment).to be_valid end end end # Alternative method: # require 'rails_helper' # descr...
true
0d28bb2a18e6979ca0f47ef9e9345d45667da923
Ruby
newtypeV2/pokemon-scraper-dc-web-051319
/lib/pokemon.rb
UTF-8
1,054
3.546875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" class Pokemon attr_accessor :name,:type,:db,:id,:hp_value def initialize(id=nil) @id = id # @hp_value = 60 end # def initialize(id:, name:, type:, hp: 60, db: ) # @id, @name, @type, @hp, @db = id, name, type, hp, db # end def self.save(name,type,db) ...
true
809a9d555797779a584f6d9c0ced0dae933abca0
Ruby
carlosmendes/sql_crud
/doctor.rb
UTF-8
728
3.0625
3
[]
no_license
class Doctor attr_reader :id def initialize(attributes = {}) @id = attributes[:id] # TODO: store other attributes as instanced variable (exercise) end # this can be called on a object/instance of the class Doctor def save # Insert object values into DB # DB.execute("INSERT INTO .....") #...
true
f4c89fb665f31570af9f04f4a47ea54f809c6359
Ruby
cjpakkie/rubyonrails
/ruby/Assignments/guessnumber.rb
UTF-8
258
3.5
4
[]
no_license
def guess_number guess number = 25 if guess == number return 'YOU GOT IT!' end unless guess < number return 'Guess was too high' else return 'Guess was too low' end end puts guess_number 25 puts guess_number 100 puts guess_number 0
true
71782bb9ed5f28a4be9513dfa346b5eadd99c616
Ruby
r3ggi/SKF-Ruby-Code-Examples
/code-examples/Directory path traversal.rb
UTF-8
901
3.15625
3
[]
no_license
# Directory/path traversal def get_files(input_parameter, pattern) validator = Validation.new # First, we want to filter the filenames for expected values. For this example we use only az/09 # Whenever the values are tampered with, we can assume an attacker is trying to inject malicious input. # for more info...
true
7174255ee7a703926fbeea1a68a155a4d6619144
Ruby
GregPDesSCH/ToronHot_Dog
/db/migrate/6_create_food_prices.rb
UTF-8
576
2.515625
3
[]
no_license
=begin ToronHot Dog Database Table and Data Creation - Food Prices Table This migrate file creates the Food Prices table in a PostgreSQL Database. Start Date: March 4, 2018 End Date: April 10, 2018 File Name: 6_create_food_prices.rb Original Source Code © 2018 Gregory Desrosiers. All rights reserved. ...
true
d2ef4bf0c01e1705759212f927464fbf9013ee1d
Ruby
schnmudgal/simple_task_manager_rails5
/spec/models/user_spec.rb
UTF-8
4,242
2.53125
3
[]
no_license
require 'rails_helper' require 'bcrypt' describe User, type: :model do describe 'Schema' do describe 'Fields' do it { is_expected.to have_db_column(:id).of_type(:integer) } it { is_expected.to have_db_column(:email).of_type(:string) } it { is_expected.to have_db_column(:password_hash).of_type(...
true
e166de78f7cc0e9f15ecada23fca3764a474203b
Ruby
nkrot/rufsl
/lesson.25/syn.rb
UTF-8
2,215
3.0625
3
[]
no_license
module Syn def self.all_matches str, re mds = [] pos = 0 while md = str.match(re, pos) pos = md.end(0) mds << md end return mds end end # This idiom allows placing self tests into non-executable ruby scripts. # This code will run only if the file is executed by running # ruby syn...
true
a287178ad8d75bdfdad9db5b37fd02341b8d1a8f
Ruby
IonicaBizauKitchen/wordrainbow
/extras/word_frequencies.rb
UTF-8
828
2.515625
3
[]
no_license
%w(rubygems wordnik).each {|lib| require lib} Wordnik.configure do |c| # c.api_key = '1d3baf57f57254b5c430200e729037e9dea9d87493f3a16b4' c.api_key = 'd92d8109432f0ead8000707303d0c6849e23be119a18df853' c.username = 'wordrainbow' c.password = 'gomer' end Wordnik.authenticate list_permalink = "wordrainbow" filena...
true
a06ce9871eaeff122897a0f14dcf755af597a8a1
Ruby
shirleytemples/Intro-to-CS-Bootcamp
/ch07/leapYearCounter.rb
UTF-8
443
3.65625
4
[]
no_license
puts 'leap years program'.center(40) puts '' puts 'what is the starting year:' starting = gets.to_i puts 'Please type an ending year:' while (ending = gets.to_i)<starting puts 'ending year should be later than starting year, please re-input:' end puts 'All leap years below:' while starting <= ending if (starting%1...
true
10136a7522414a260f745357d6fc58158f1d1361
Ruby
Kinselan/launch-school
/lesson3/easy1/ex5.rb
UTF-8
96
2.96875
3
[]
no_license
# determine if 42 lies between 10 and 100 puts (10..100).include?(42) # could also use .cover?
true
7696bcfba358c122e011a638cd794f3d5ed3b36f
Ruby
ahrke/Launch_School
/RB101_RB109/small_problems/easy_3.rb
UTF-8
5,177
4.6875
5
[]
no_license
# Question 1 # Write a program that solicits 6 numbers from the user, then prints a message # that describes whether or not the 6th number appears amongst the first 5 numbers. def q1_get_num puts "Enter a number please: " gets.to_i end q1_user_arr = [] 5.times { q1_user_arr << q1_get_num } q1_last_num = q1_ge...
true
0f26d1c866dada226792adcfbb04f8c58dec0ab0
Ruby
Anton-Kalyutich/programming-univbasics-3-methods-default-values-lab-nyc01-seng-ft-080320
/lib/meal_choice.rb
UTF-8
173
3.3125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def meal_choice(veg_1, veg_2, protein = "tofu") puts "What a nutritious meal!" message = "A plate of #{protein} with #{veg_1} and #{veg_2}." puts message message end
true
29606058c7ba06d1db7fd31f3fd588907721d4de
Ruby
DonRichards/aspace_reporting
/lib/accessor_report.rb
UTF-8
3,598
2.859375
3
[]
no_license
require "mysql2" require 'rubyXL' #Reject all table from 0 ... 0x1F except "\n", "\r", "\t" KEPT_CHARS="\n\r\t".split('').map(&:ord) REJECTED_CHARS = (0..0x1F).reject{|x| KEPT_CHARS.include?(x) }.map(&:chr).join class AccessorReport attr_accessor :sql_data, :excel_file attr_reader :root def initialize @r...
true
da1bd77c73936aa911a652ecd6d92484e9872acf
Ruby
smcunning/backend_mod_1_prework
/day_7/programs/10_speckled_frogs.rb
UTF-8
950
4.0625
4
[]
no_license
# _ speckled frogs sat on a log eating some most delicious bugs. # One jumped in the pool where it's nice and cool, # then there were _ speckled frogs # or - then there were no more speckled frogs @ 0 frogs 10.downto 1 do |frogs| if frogs > 0 puts "#{frogs} speckled frogs sat on a log eating some most deliciou...
true
9b2501797ca1a9f3fcf54e219ec6f87ec7448420
Ruby
EmilyPillmore/Project-Euler
/includes/Ruby/Prime.rb
UTF-8
447
4.09375
4
[]
no_license
# Declare function def IsPrime(number) # 1 and 2 are both prime return 1 if(number < 3 && number > 0) # Any even number other than 2 is not prime return 0 if(number % 2 == 0) # Declare variables x = 3 limit = number; # Loop while x < limit while x < limit # If this hits the number isn't prime return 0 i...
true
d565dd611b2c5fb4839c67c32610e7d2a342b851
Ruby
itsonlymoe/ruby_fundamentals1
/exercise4.rb
UTF-8
170
3.796875
4
[]
no_license
(1..100).each do |num| if num %3 == 0 puts "bit" elsif num % 5 ==0 puts "maker" elsif num % 3 == 0 && num %5 == 0 puts "bitmaker" else puts num end end
true
96f5f2d00de4249f1955d11f6259584e8ded21bf
Ruby
RedQuake/learn_ruby
/sum_if_even.rb
UTF-8
147
3.625
4
[]
no_license
def sum_if_even(arr) y = 0 arr.each {|x| if x % 2 == 0 y = y + x else end } return y end p sum_if_even([1,2,3,4,8]) p 14
true
c0260f533797baab473e0f36e0006f82d947b2d8
Ruby
mruby-plato-mgem/mruby-plato-sensor-adt7410
/mrblib/adt7410.rb
UTF-8
690
2.96875
3
[]
no_license
# # PlatoDevice::ADT7410 class # module PlatoDevice class ADT7410 < Plato::Sensor I2CADDR = 0x48 def initialize(addr=I2CADDR, ndigits=3, unit=:C) @i2c = Plato::I2C.open(addr) @ndig = ndigits @unit = unit end def temperature(unit=nil) uint = @unit unless unit tmpa...
true
4a24823118dc21b316721ed566fea33eace9d4ee
Ruby
AKnopf/trait
/lib/method_aliasing.rb
UTF-8
1,392
3.390625
3
[]
no_license
module MethodAliasing # Returns the name of the module without its nesting # @example # Trait[MyApp::MyTraits::MyAwesomeTrait].simple_name #=> "MyAwesomeTrait" def simple_name module_or_self.to_s[/\w+\z/] end # Aliases all methods in +method_names+ with a suffix that is dependent on trait n...
true
d650d3483bc0d869be2880d42d1b0123135a917f
Ruby
CKolkey/critiq
/app/jobs/send_slack_message_all_job.rb
UTF-8
3,095
2.703125
3
[]
no_license
class SendSlackMessageAllJob < ApplicationJob queue_as :default # Args: ARRAY of a HASH: Question_ID & Survey_ID def perform(*args) puts "" puts "* Sending in 5s..." sleep(5) puts "* Inside SendSlackMessageAllJob *" puts "> Finding Survey with id #{args[0][:survey_id]}" survey = Survey....
true
d9c43d42e903dc3e627f365e058936c703dc80a9
Ruby
DrAmaze/appacademy
/W1D2/Board.rb
UTF-8
1,216
3.8125
4
[]
no_license
require_relative "Card.rb" class Board CARDS = [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8] def self.default_grid # [ [],[],[],[] x 4] Array.new(4) { Array.new(4) } end def self.random self.new(self.default_grid, true) end attr_accessor :grid def initialize(grid = Board.default_grid, random = false) ...
true
4525c1d7c4a6ffb99678301641d9dc43e02a999c
Ruby
ryan-jr/theodinproject
/course3-ruby_programming/step3-projects-ruby-building-blocks/ceasercipher.rb
UTF-8
1,044
4.03125
4
[]
no_license
#Ceasar Cipher #Using the alphabet to have something to index alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ] #punctuation to check against punct = [" ", ",", ".", "!", "?"] #user input and implementing a spl...
true
34d95b06886fd37f8076594a72685c5a68dfb980
Ruby
beck03076/CrawlFish
/lib/modules/search_module.rb
UTF-8
700
2.671875
3
[]
no_license
module SearchModule def get_size(search_key) search_key.gsub(/[^A-Za-z0-9 ]/,"").squeeze.split.size end def check_specificity(master_hash, type) master_hash.keys.each do |i| a = master_hash[i][type.to_sym].flatten if !(a.empty?) if ...
true
07d6bedc7b3352d6b762d185b4381b423ec844bb
Ruby
ltater/website_v2
/app/helpers/static_pages_helper.rb
UTF-8
286
2.5625
3
[]
no_license
module StaticPagesHelper # Returns default text if About This Page is blank def about_page(page_description = '') base_description = "This page was created dynamically via a database." if page_description.empty? base_description else "#{page_description}" end end end
true
a4607a66e641f4ddbe8150710d025d59f5cf6116
Ruby
arirusso/spall
/lib/spall/instructions/midi.rb
UTF-8
1,568
2.703125
3
[ "Apache-2.0" ]
permissive
module Spall module Instructions # Instructions for dealing with MIDI module MIDI # Set the master MIDI channel to receive messages on # can be overriden on an instruction by instruction bases # @param [Fixnum, nil] num The channel number 0-15 or nil for all def master_channel(num) ...
true
547445d69c8594bbf4bae9a3976c076662d7a20c
Ruby
benrodenhaeuser/LS_100
/05_iteration_and_recursion/doubler.rb
UTF-8
102
2.984375
3
[]
no_license
# doubler def doubler start puts start if start <= 10 doubler start * 2 end end doubler(2)
true
e9a7be5910771814fd56037adbd47272978b628e
Ruby
kupolak/codewars
/Ruby/8 KYU/Online RPG: player to qualifying stage?.rb
UTF-8
187
2.9375
3
[]
no_license
def playerRankUp(points) if points >= 100 return "Well done! You have advanced to the qualifying stage. Win 2 out of your next 3 games to rank up." else return false end end
true
e22a982c1c2e10a581d0c66839ca2efb93e48161
Ruby
mzahrada/Rectangles
/lib/rectangles/input_handler.rb
UTF-8
1,933
3.78125
4
[]
no_license
require_relative 'rectangle' module Rectangles # Implements handler for users input. # Creates array of two squares from users input. class InputHandler # Names of squares. @@square_names = ["prvniho", "druheho"] # Error message raised when wrong input provided. INPUT_ERROR = "Spatny vstup." ...
true
40d70da6e648a379d4e149d3a4bb2597d7a117c5
Ruby
julienm71/gym_cluny
/db/seeds.rb
UTF-8
640
2.546875
3
[]
no_license
User.destroy_all Post.destroy_all puts "--> Database erased." puts "--> Database reconstruction in progress..." useradmin = User.new( pseudo: 'Admin', email: 'admin@test.fr', password: 'test123', admin: true, ) useradmin.save! posttest = Post.new( titre: 'Titre', titre_secondaire: 'Titre secondaire', d...
true
91e1dea7d5aa230fd3485b7f8bc52c8f232ceb28
Ruby
bdone2012/music_ir
/tools/test_autocorrel_phrase_detection.rb
UTF-8
7,717
2.859375
3
[]
no_license
#!/usr/bin/env ruby require 'music_ir' $LOAD_PATH << 'spec/vectors' require 'meter_vectors' class Predictor def initialize @correct = 0 @incorrect = 0 end def observe!(actual, expected) if actual == expected @correct += 1 else @incorrect += 1 end end def accuracy @correc...
true
7e36fe07f96632723609ce225867f8872937a4ae
Ruby
jondscott21/ruby-fun-oop
/humans/human.rb
UTF-8
499
3.921875
4
[]
no_license
class Human attr_accessor :strength, :intelligence, :stealth, :health, :name def initialize(name) @name = name @strength = 3 @intelligence = 3 @stealth = 3 @health = 100 end def attack(value) if value.class.ancestors.include? Human puts "You attacked #{value.name}" value.heal...
true
a336aa80c93459560cc36fe439cce5bc107c76a2
Ruby
iskounen/kanbun
/lib/sentence.rb
UTF-8
228
3.34375
3
[ "MIT" ]
permissive
# frozen_string_literal: true # a string of Chinese words to be read in Japanese class Sentence attr_reader :words def initialize(words) @words = words end def read @words.sort.map(&:character).join end end
true
ab07c120592d29f794e64822a5a37933998d6a97
Ruby
gconen/app-academy-assignments
/w1d1/to_s.rb
UTF-8
589
3.671875
4
[]
no_license
hash = { 10 => 'A', 11 => 'B', 12 => 'C', 13 => 'D', 14 => 'E', 15 => 'F' } (0..9).each do |number| hash[number] = "#{number}" end HASH = hash def num_to_s(num, base) # num_string = "" # power = 0 # while (base ** power) < num # digit = (num / (base ** power)) % base # num_string = hash...
true
f289a10fd802d47939f10b63546355d05137da0f
Ruby
nicsiv/ruby-enumerables-array-count-lab-chi01-seng-ft-091420
/lib/array_count.rb
UTF-8
166
3.328125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def count_strings(array) array.count do |element| element.is_a?(String) end end def count_empty_strings(array) array.count do |element| element == "" end end
true
14dc0995490e2108b0d2dd61630bc17b54bd7688
Ruby
jimb-cc/twits
/twits.rb
UTF-8
4,257
2.8125
3
[]
no_license
# frozen_string_literal: true # This script contains methods to add, remove, and retrieve rules from your stream. # It will also connect to the stream endpoint and begin outputting data. # Run as-is, the script gives you the option to replace existing rules with new ones and begin streaming data require 'json' requir...
true
32b8180f153af3dd0955984c6a137a937ac9f64f
Ruby
frenchy0007/tic-tac-toe-rb-bootcamp-prep-000
/bin/tictactoe
UTF-8
246
3.515625
4
[]
no_license
#!/usr/bin/env ruby require_relative '../lib/tic_tac_toe' #defines empty board board = [" ", " ", " ", " ", " ", " ", " ", " ", " "] #welcomes user puts "Welcome to Tic Tac Toe!" #displays board display_board(board) #starts game play(board)
true
8e2f37ef61e5d1e297bb1ac768b3c46802296070
Ruby
Reetok3/hq9-_compiler
/main.rb
UTF-8
1,051
3.640625
4
[]
no_license
class HQ9Plus def initialize(src) @src = src @count = 0 @slash = 0 end def run @src.each_char do |c| case c when "H" # Hello, World hello when "Q" # Quine quine when "9" # 99 of bottles of beer print_99_of_bottles_of_beer when "+" # Plus plus when "S" say...
true
219cf50f5ff7da30aa9326b5ef1bcd2b81ae6a87
Ruby
saumya-agsft/ruby
/ruby_prac/bil.rb
UTF-8
1,706
3.578125
4
[]
no_license
# password = 12345678 # puts "please enter your password" # password = gets.chomp.to_i # if password ==12345678 # puts "you are successfully entered" # else # puts "password is wrong" # end # arr=[101,102,103] # brr=["soap","shampoo","powder"] # crr=[10,20,30] # item=101 # arr.each_with_index do |item,index| #...
true
6b9e8eed705ab15f1032952eefea33911e0a862c
Ruby
ayva/134141414kjkjfksjafsakfjl
/spec/week1_assessment_spec.rb
UTF-8
4,526
3.5
4
[]
no_license
require_relative '../lib/week1_assessment' describe Weapon do let(:weapon){ Weapon.new("FooWeapon", 10) } describe '#initialize' do it 'raises an exception if run without a name or value' do expect{ Weapon.new }.to raise_error end it "has a name attribute" do expect( weapon.name ).to e...
true
cf7263115d32a388b06a9bc90705b152b8d14033
Ruby
duranangela/black_thursday
/lib/invoice_item.rb
UTF-8
687
2.9375
3
[]
no_license
require 'bigdecimal' require 'time' class InvoiceItem attr_reader :id, :item_id, :invoice_id, :created_at attr_accessor :quantity, :unit_price, :updated_at def initialize(invoice_item) @id = invoice_item[:id].to_i @item_id = invo...
true
a44e3a8968cccef194ad2fd92bb4ba8ff7c5cd06
Ruby
exwarvlad/notepad
/lib/tweet.rb
UTF-8
2,503
3.03125
3
[]
no_license
# encoding: utf-8 # Программа "Блокнот" # подключаю библиотеку twitter require 'twitter' # Класс Твит, разновидность базового класса "Запись" class Tweet < Post # конфигурируем твитер клиент согласно документации https://github.com/sferik/twitter/blob/master/examples/Configuration.md @@CLIENT = Twitter::REST::Cl...
true
90c994839cb1e60dfc1dfb562f96a2b002d9e061
Ruby
SamShapiro/RubyRampUp2015
/game/obstacle.rb
UTF-8
488
2.96875
3
[ "Apache-2.0" ]
permissive
class Obstacle def initialize (x=rand(640), y = 0.0, small=false, angle=0) @astImage = Gosu::Image.new('media/Asteroid.png') @x = x @y = y @small=small @angle=angle @invinceCounter = 0 end attr_reader :small, :x, :y, :invinceCounter, :astImage def update @x += Gosu::offset_x(@angle, 1) @y += Gosu...
true
9189a688f1a5a213c146026951757928d169d3c7
Ruby
ekdillon/ttt-5-move-rb-cb-gh-000
/bin/move
UTF-8
257
3.28125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#!/usr/bin/env ruby require_relative '../lib/move.rb' board = [" ", " ", " ", " ", " ", " ", " ", " ", " "] puts("Welcome to Tic Tac Toe!") puts "Please enter 1-9:" i = gets.strip index = input_to_index(i) move(board, 0, char = "X") display_board(board)
true
fa38906ffcc94dc41bd788b3ee07936294728af2
Ruby
chewieee/test-first-ruby-solutions
/13_xml_document/xml_document.rb
UTF-8
827
3.46875
3
[]
no_license
# 13. XML Document class XmlDocument def initialize(indent=false) @indent = indent @indent_level = 0 end def method_missing(tag, *attribs, &block) # Sets attributes depending on number of args attributes = attribs[0] || {} # instantiate empty string to receive input string = "" # initial indenting ...
true
4ea1713c5c737dc4acce66eade636d1e708fc78d
Ruby
timpalpant/bioruby-genomic-file
/spec/bio/affy_spec.rb
UTF-8
3,389
2.828125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# # affy_spec.rb # bioruby-genomic-file # # Created by Timothy Palpant on 5/31/11. # Copyright 2011 UNC. All rights reserved. # require 'spec_helper' require 'bio/affy' describe AffyFile do AFFY_FILE = File.expand_path(File.dirname(__FILE__) + '/../fixtures/test.affy') before do @test = AffyFile.new(AF...
true
0b01527b1fbef17a76d124026297e8484d35b269
Ruby
you7588/shengjing
/ruby_basic/8.2_hello_class.rb
UTF-8
211
3.34375
3
[]
no_license
class HelloWorld def initialize(myname = "Ruby") @name = myname end def name @name end def name=(value) @name = value end end bob = HelloWorld.new"Bob" p bob.name bob.name = "Robert"
true
d5f737997d4a85c36b48176d99ecccf96efc27d6
Ruby
learn-co-curriculum/hs-scraping-imdb
/imdb_scraper.rb
UTF-8
1,007
3.390625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' require 'nokogiri' require 'open-uri' class IMDbScraper def initialize(site) imdb_html = open(site) @imdb_nokogiri = Nokogiri::HTML(imdb_html) end def get_all_info "Movie: #{get_movie_title}\nDirector: #{get_director}\nStars: #{get_stars}\nStoryline: #{get_storyline}\nRating: #{get_mpaa_rating...
true
a4badcc8376484c38b52388fa9f1d40f377e3ee9
Ruby
justinhj/adventofcode2018
/day1ruby/day1part2.rb
UTF-8
555
3.6875
4
[]
no_license
# Day 1 of Advent of Code 2018 part 2 # https://adventofcode.com/2018/day/1 # require 'pry-byebug' require 'set' filename = ARGV.first || __dir__ + '/input.txt' file = File.open(filename, 'rb') contents = file.read lines = contents.split("\n") # Return the first element we encounter twice # Need a set to remember...
true
4daf1175acdc83c964ab961dcc4d382b062df60a
Ruby
sultanhq/roman_numerals
/spec/roman_numerals_spec.rb
UTF-8
1,101
3.421875
3
[]
no_license
require './lib/roman_numerals.rb' describe Roman_numerals do # i = 1 iv = 4 v = 5 vi = 6 ix= 9 x = 10 l = 50 c = 100 d= 500 m = 1000 it "should be able to convert 1 to I" do expect(Roman_numerals.convert(1)).to eq ("I") end it "should be able to convert 5 into V" do expect(Roman_numerals.convert(5))...
true
3ef009c2ed6bf5c16775bb1ceab775652e1dd800
Ruby
rinapratama335/belajar-ruby
/9.module/1.module.rb
UTF-8
471
3.6875
4
[]
no_license
##Module #module digunakan untuk mengelompokkan suatu kelas ataupun method module Constant #membuat konstanta XXX = 100 def method puts 'method dari dalam kelas Constant' end #membuat module di dalam module module A XXX = 500 end end #kita bisa langsung memanggil nilai ko...
true
9ce299782dff23fc949a8180b2f110071193e343
Ruby
rarrunategu1/ruby_practice
/readingFiles.rb
UTF-8
569
3.703125
4
[]
no_license
#File.open("employees.txt", "r") do |file| #reads entire file #puts file.read() #returns boolean if Julie is included in the file #puts file.read().include? "Julie" #reads 1st readline #puts file.readline() #reads second line #puts file.readline() #reads the first character of the fil...
true
614ff2b9bcea2bc9025268845ee0a2de544c119d
Ruby
ruby-rdf/rdf-n3
/lib/rdf/n3/algebra/log/semantics.rb
UTF-8
2,119
2.59375
3
[ "LicenseRef-scancode-public-domain", "Unlicense" ]
permissive
module RDF::N3::Algebra::Log ## # The log:semantics of a document is the formula. achieved by parsing representation of the document. For a document in Notation3, log:semantics is the log:parsedAsN3 of the log:contents of the document. For a document in RDF/XML, it is parsed according to the RDF/XML specification t...
true
bfe51467db687f7e5f7b5b43734d3ef746413b4e
Ruby
hosh/cloudformation-dsl-rb
/lib/cloudformation-dsl/helpers.rb
UTF-8
4,059
2.703125
3
[ "Apache-2.0" ]
permissive
module CloudFormationDSL module Helpers def load_from_file(filename) file = File.open(filename) # Figure out what the file extension is and process accordingly. case File.extname(filename) when ".rb"; eval(file.read, nil, filename) when ".json"; JSON.load(file) when ".yaml"; YA...
true
d8485e5c342a6ed1cd87ff9605683645eba92cbb
Ruby
dacogemini/nodelesstraveled
/vendor/bundle/gems/rails_autoscale_agent-0.3.1/lib/rails_autoscale_agent/collector.rb
UTF-8
686
2.53125
3
[ "MIT" ]
permissive
require 'rails_autoscale_agent/logger' module RailsAutoscaleAgent class Collector extend Logger def self.collect(request, store) if request.entered_queue_at if request.entered_queue_at < (Time.now - 60 * 10) # ignore unreasonable values logger.info "request queued for more ...
true
531784edfc6ce97b37063d55d7feacdfeeb961d1
Ruby
WilliamJones62/avfc_game_posts
/app/models/game.rb
UTF-8
350
2.53125
3
[]
no_license
class Game < ApplicationRecord has_many :reviews, inverse_of: :game, :dependent => :destroy before_create :save_date def save_date self.formatted_date = self.game_date.strftime("%m-%d-%Y") end def avg_rating rating = 0.0 if reviews.length > 0 rating = reviews.average(:rating).round(2).to_f...
true
1f7f1722af03b6e410c7b5b4b43df71cd5af3d20
Ruby
jldelorimier/independent_practice
/change_machine.rb
UTF-8
2,283
4.34375
4
[]
no_license
# You will be creating a method that will take a number of cents and return an array of coins that will be your change. The goal is to return as few coins as possible. Assume that the highest denomination of coins will be a quarter (25 cents). For example: If the method receives 119, the result will be [25, 25, 25, 25,...
true
f8b02abf7b48cd8679e70c70eb1daecc631594da
Ruby
SaphMB/boris-bikes-day-five
/spec/docking_station_spec.rb
UTF-8
501
2.65625
3
[]
no_license
require 'docking_station' describe DockingStation do it 'docking station responds to release bike' do expect(subject).to respond_to(:release_bike) end it 'docking station gets a bike' do expect(subject.release_bike).to be_a(Bike) end it 'allows a user to dock a bike' do bike = Bike.new expe...
true
83be74654af089bd5f4271db9c79493aede10e43
Ruby
Freddy-Harimanana/ruby-master
/lib/04_simon_says.rb
UTF-8
764
3.875
4
[]
no_license
def echo(mot) return mot end def shout(mot) return mot.upcase end def repeat(mot,a = 2) smot = mot for i in 1...a smot = smot + " " + mot end return smot end def start_of_word(mot,index) a = "" for i in 1..index a += mot[i-1] end return a end def first_word(words) words_array = words.split("...
true
27a09973c24558eb6d695334ec00289a2721b890
Ruby
feigningfigure/WDI_NYC_Apr14_String
/w01/d05/Keyan_Bagheri/animal_shelter/classes/animal.rb
UTF-8
322
4.03125
4
[]
no_license
class Animal attr_accessor :name, :age, :species, :toys def initialize(name,age,species) @name = name @age = age @species = species @toys = [] end # toy_string = @toys.each { |toy| toy.to_s} # puts "toy_string" def to_s "#{@name} is a #{@age} year old #{@species} that loves " + toys.join(", ") end e...
true
acb5963364038fcb133dccad0516b04c6dfed879
Ruby
noriyagi/MetaProgramming
/lib/ctwc/array_explorer_safe.rb
UTF-8
83
2.625
3
[]
no_license
def explore_array(method, *arguments) ['a','b','c'].send(method, *arguments) end
true
42cc247b9b4edd97a7ca9954cefe554a032e815a
Ruby
15jramirez/school-domain-onl01-seng-pt-081720
/lib/school.rb
UTF-8
455
3.484375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class School attr_reader :roster, :name, :grade def initialize (name) @name = name @roster = {} end def add_student(name, grade_level) if @roster.include? (grade_level) @roster[grade_level] << name else @roster [grade_level] = [name] end end def grade (grade_level) @roster[grad...
true
c0353939255c66dad9cdd6f0b58810c1890dac96
Ruby
Zheka1988/ruby_replay
/change_hash_class.rb
UTF-8
597
3.578125
4
[]
no_license
# class Hash # def method_missing(name) # # if self.keys.any? { |key| key == name.to_s || key == name.to_sym} # # if self.keys.include? name.to_s # # self[name.to_s] # # else # # self[name.to_sym] # # end # # else # # raise NoMethodError # # end # self[name.to_...
true
de227d19c4613d2425f403633bcddb39655bd2b5
Ruby
lectral/powers
/lib/powers/view_ranking.rb
UTF-8
902
2.84375
3
[]
no_license
module Powers class ViewRanking include ActionView::Helpers::NumberHelper HEADINGS = %w[name source story lvl bp bph].freeze def initialize(result) @data = result end def print to_print = [] @data.each do |char| char.stories.each do |story| to_print.push [char....
true
02f4cbad8ad7094acbd7faf13fb4af9f7048eb34
Ruby
MarcusAl/MVC-Hackernews-Blog
/app/views/posts_view.rb
UTF-8
492
2.90625
3
[ "MIT" ]
permissive
require_relative '../models/post' class PostsView # TODO: implement methods called by the PostsController def initialize @posts = Post.new end def list_all_posts array = @posts.all.flatten array.each do |post| puts '----------------' puts "#{post.id}.#{post.title}" puts post.url ...
true
ca52e5ab03513451c53f54eb7ebf38a05f7a5d8a
Ruby
cthtuf13/Ruby_Programming_tasks-master
/src/2-part/63-task.rb
UTF-8
266
3.140625
3
[ "MIT" ]
permissive
def task_63(r, s) a = 5 b = 4 if a % b == r puts "Остатoк рівний числу #{r}" elsif a % b == s puts "Остатoк рівний числу #{s}" else puts "Остатoк рівний != #{s} and #{r}" end end task_63(2, 1)
true