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
6a30f26de186b90475477377482f59bec8f23a50
Ruby
kipkosek/kele
/lib/kele.rb
UTF-8
964
2.671875
3
[]
no_license
require 'httparty' require 'json' require_relative 'roadmap' require_relative 'messages' class Kele include HTTParty include Roadmap include Messages base_uri "https://www.bloc.io/api/v1" def initialize(email, password) response = self.class.post("https://www.bloc.io/api/v1/sessions", body: { email: em...
true
6411cc5faa65bbceba3a73b0eba621021c3d8ee9
Ruby
djstozza/shift_care_code_test
/app/serializers/client_serializer.rb
UTF-8
886
2.546875
3
[]
no_license
# == Schema Information # # Table name: clients # # id :bigint not null, primary key # date_of_birth :date not null # email :citext not null # first_name :citext not null # last_name :citext not null # private_note :string # created_a...
true
bfccc2bc5864a7c04e6f3c6815da544864ca112e
Ruby
jwhiteman/zeromq
/ch3/asyncserv.rb
UTF-8
2,447
2.59375
3
[]
no_license
# socket.identity=() # poller.register_readable() # socket.recv_strings # poller.poll(msecs) => int # poller for async reading from a single socket # rand(n..m) # rand() # bare # ZMQ::Device.create() # ZMQ::QUEUE # poller sans poll in the server routine # ensure fucks up interrupts ? require "ffi-rzmq" require "openssl...
true
3bafe1bf4971f757baac74f9a11a70f04dae1b9e
Ruby
MoMI-G/MoMI-G
/scripts/bam2gam/uuid.rb
UTF-8
523
2.9375
3
[ "MIT", "LicenseRef-scancode-w3c-03-bsd-license", "BSD-3-Clause", "CC-BY-4.0", "MIT-0", "GPL-1.0-or-later", "MPL-2.0", "WTFPL", "MIT-Wu", "CC0-1.0", "ISC", "GPL-2.0-only", "LicenseRef-scancode-unknown-license-reference", "Unlicense", "Apache-2.0", "LicenseRef-scancode-public-domain", ...
permissive
#!/bin/ruby # # previous_line = [] count = 0 STDIN.each_line do |line| line = line.split(" ") current_id = line[3] if previous_line.length > 3 && previous_line[3] == current_id previous_line[3] += "_#{count}:#{previous_line[5]}" count += 1 else #count += 1 previous_line[3] += "_#{count}:#{prev...
true
f7aba3e608a3bbd7bb579796d87e2a5edb88fbf0
Ruby
arifk-repo/Homework
/test/category_spec.rb
UTF-8
1,652
2.5625
3
[]
no_license
require '../models/category' require '../controllers/category_controller' require 'erb' describe CategoryController do context '#category' do before(:each) do @category_controller = CategoryController.new end it "get all category from database" do actual_view = @category_controller.index_ca...
true
d59ef736b18e577582523672e104697743c3aa2c
Ruby
AudreyLeeMe/bikle100
/app/cj/predictions/fx_past/run_fx_past_week.rb
UTF-8
1,968
3.03125
3
[]
no_license
# # run_fx_past_week.rb # # I use this script to loop through spool files created by sqlplus. require 'rubygems' require 'hpricot' # require 'ruby-debug' # I start by getting a list of spool files created by sqlplus: glb = Dir.glob("/pt/s/rl/bikle100/app/cj/predictions/fx_past/tmp_fx_past_week_20*.lst").sort glb.ea...
true
6d583f9b78e49c4bccb928fe8194324437a42d35
Ruby
mkroman/blur
/library/blur/channel.rb
UTF-8
2,206
2.90625
3
[ "ISC" ]
permissive
# frozen_string_literal: true module Blur # The +Channel+ class is used for encapsulating a channel and its properties. # # Users inside the channel is stored in the {#channels} attribute. # # Modes can be set for a channel, but Blur is not # {http://www.irc.org/tech_docs/005.html ISupport}-compliant yet. ...
true
ed1d308e3c9763cd9710518adc1905bc6ed63b9e
Ruby
omairqazi29/liquid-galaxy
/kamelopard/lib/kamelopard/geocode.rb
UTF-8
2,118
3.234375
3
[ "GPL-1.0-or-later", "Ruby", "GPL-2.0-only", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-or-later", "GPL-2.0-or-later", "Apache-2.0" ]
permissive
# vim:ts=4:sw=4:et:smartindent:nowrap require 'rubygems' require 'net/http' require 'uri' require 'cgi' require 'json' # Geocoder base class class Geocoder def initialize raise "Unimplemented -- some other class should extend Geocoder and replace this initialize method" end def lookup(address) ...
true
db7a3dee41ce2acd4aa7d03049e0516a4c7940fe
Ruby
chrisberkhout/ffaker
/lib/ffaker/lorem.rb
UTF-8
2,494
2.65625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Faker # Based on Perl's Text::Lorem module Lorem extend ModuleUtils extend self def word WORDS.rand end def words(num = 3) WORDS.random_pick(num) end def sentence(word_count = 4) s = words(word_count + rand(6)) s = s.join(' ') s.capitalize! "...
true
7a701facef4a442eff12e33920374bd5a460ad0c
Ruby
kevinjd/vivixx
/friday.rb
UTF-8
1,072
3.90625
4
[]
no_license
def convertion puts "Enter the temp in Celcius" tempc = gets.chomp.to_f tempf = (tempc * 9) / 5 + 32 puts tempf puts "Converting back to Celcius" temf = (tempf - 32) * 5 / 9 puts temf puts "Initial Fare is 35\n" puts "Enter the distance of destination in kilometers" dist = gets.chomp.to_f distConv...
true
8f8fb92ff55a21c4125d1cbe2324efcacc1ed1b1
Ruby
nburt/weather_data_api
/spec/kelvin_converter_spec.rb
UTF-8
555
3.265625
3
[]
no_license
require 'spec_helper' require './lib/kelvin_converter' describe KelvinConverter do it 'can return temperature in Kelvin' do kelvin_converter = KelvinConverter.new(1) expect(kelvin_converter.convert('Kelvin')).to eq 1 end it 'can convert Kelvin to Fahrenheit' do kelvin_converter = KelvinConverter.ne...
true
0c1c9745a5ca1dd8a531a56545e8aea88f0c7c3b
Ruby
PD2015/launch_school
/oop/lesson_4/medium1.rb
UTF-8
2,198
4.625
5
[]
no_license
# 4) # Let's practice creating an object hierarchy. # Create a class called Greeting with a single method called greet that takes a string # argument and prints that argument to the terminal. # Now create two other classes that are derived from Greeting: one called Hello and one # called Goodbye. The Hello class sh...
true
6441714fc723ed9505392085eee50553adeddab8
Ruby
kristianmandrup/twitter-bootstrap-helpers
/lib/twitter-bootstrap-helpers/view_helpers.rb
UTF-8
1,225
2.53125
3
[ "MIT" ]
permissive
module TwitterBoots class << self attr_writer :validate def validate @validate ||= true end alias_method :validate?, :validate def validate_type! type return true if !validate? || valid_type?(type) raise ArgumentError, "Not a valid type: #{type}, must be one of: #{valid_types}"...
true
82b8fa9a928fcaf97557eb342c9847f6fc2397ce
Ruby
vietluonghoang/ruby_data
/lib/test_chamber/app/creator/app_ui_base.rb
UTF-8
941
2.59375
3
[]
no_license
module TestChamber::Creator class App # Common logic needed for both V1 and V2 UI app creation module UiBase # The api and UI have different platform strings so translate them so we can find them in the UI def translate_platform_to_ui(platform) translated = { 'android' => 'Andr...
true
cec9095e8a6b0159aa90f098222ee49ec43d17b7
Ruby
rickhull/compsci
/lib/compsci/graph.rb
UTF-8
14,515
3.203125
3
[]
no_license
require 'set' module CompSci class CycleError < RuntimeError; end class MultiGraphError < RuntimeError; end class UnexpectedError < RuntimeError; end # represents an edge between two vertices, *src* and *dest* Edge = Data.define(:src, :dest, :value) do def initialize(src:, dest:, value: nil) super...
true
c572064ee3d242f70e21207541455de742b05b43
Ruby
skryl/cursed
/lib/cursed/elements/full_grid.rb
UTF-8
747
2.890625
3
[ "MIT" ]
permissive
class Cursed::FullGrid < Cursed::Grid CELL_SIZE = 2 def initialize(container, opts) super(container, opts) @cell_size = opts[:cell_size] || CELL_SIZE @box_size = @cell_size + 2 @cratio = @box_size @rratio = 2 end private def draw full_grid(1, 1) end #TODO: refactor me # def ...
true
f8689e4de4a9ec9912fa7443d5c7905dd7173e7c
Ruby
froot/advent_2019
/day_1/p2.rb
UTF-8
322
3.46875
3
[]
no_license
filename = 'input_1.txt' fuels = [] modules = File.readlines(filename).map do |line| line.to_i end modules.each do |mass| fuels << (mass/3) - 2 while(fuels.last != 0) next_fuel = (fuels.last/3) - 2 if next_fuel.negative? fuels << 0 else fuels << next_fuel end end end puts fuels.su...
true
0a14efc33fcb3e103688cf28e62f0fe09b319a32
Ruby
max-codeware/rbLinCAS
/System/Intermediate/SymbolTable/SymbolTabEntry.rb
UTF-8
4,684
3.078125
3
[]
no_license
#! /usr/bin/env ruby ## # This is an implementation of a symbol table entry for LinCAS. # It collects datas on the entered identifier, and works like a symbol # table for all the identifier related to that one. A graphical # representation can be: # ``` # ENTRY: # |- NAME # |- DEFINITION # |- PATH # |- LEVEL #...
true
ad2faf70fa17dc5c5cb43b8066bf33d1bd44dadc
Ruby
ronniekram/codewars
/leetcode/duplicates.rb
UTF-8
420
3.515625
4
[]
no_license
# @param {Integer[]} nums # @return {Boolean} def contains_duplicate(nums) new_nums = nums.each_with_object(Hash.new(0)) do |element, num_hash| num_hash[element] += 1 end new_nums.values.any? {|num| num > 1} ? true : false end # Runtime: 84 ms, faster than 11.00% of Ruby online submissions for Contains Dup...
true
34e1a408142b66453c426894aeb2754742b6b7d3
Ruby
Martin-Nyaga/emerald
/spec/error_spec.rb
UTF-8
886
2.578125
3
[]
no_license
require "spec_helper" require "emerald/error" describe Emerald::Error do it "shows a contextual error message for a single line script" do file = Emerald::Files::ScriptFile.new("foo @ world") raise Emerald::Error.new("test error", file, 4) rescue Emerald::Error => e message = <<~MSG Error: test ...
true
4b08a5d5a76024cd0f5a87ae56a1704bd7fb8e06
Ruby
Kite0301/atcoder
/cf2015/team/class_test.rb
UTF-8
206
3.546875
4
[]
no_license
class Cat attr_accessor :name, :color def initialize(name, color) @name = name; @color = color end def add puts "#{self.name}-#{self.color}" end end cat=Cat.new("Tama", "white") cat.add
true
5116c12c66b727b8588b0f2e95a5115299e02227
Ruby
ColinOsborn/scrabble
/test/scrabble_test.rb
UTF-8
614
2.84375
3
[]
no_license
gem 'minitest' require_relative '../lib/scrabble' require 'minitest/autorun' require 'minitest/pride' require 'pry' class ScrabbleTest < Minitest::Test def test_it_can_score_a_single_letter assert_equal 1, Scrabble.new.score("a") assert_equal 4, Scrabble.new.score("f") end def test_it_can_be_a_full_word...
true
012628eb4ec257f5d7ef02b8f7823679cf622f4a
Ruby
abhi1988srivastava/Ruby
/exception_handling.rb
UTF-8
1,754
3.921875
4
[]
no_license
=begin Exception handling: similar to try-catch-finally of java.. try => begin catch => rescue finally => ensure =end begin res=1/0 rescue Exception => e x=0 puts(e.class) #prints out class : ZeroDivisionError, can also be achieved as puts($!.class) ; catches last exception puts(e) # description : divided by 0 en...
true
7b1b8bfce67f2685c291422010ac6aeca79485e9
Ruby
littlethao/rectangle
/rectangle.rb
UTF-8
254
3.390625
3
[]
no_license
def print_rectangle length = ARGV[0].to_i height = ARGV[1].to_i top = "-" * length body = [] height.times do body.push("|" + (" " * (length - 2)) + "|") end last = "-" * length puts top puts body puts last end print_rectangle
true
961ce978a99389d5f2a604b3e2974d599b8657c9
Ruby
growenthall/thehardway
/ex1.rb
UTF-8
83
2.703125
3
[]
no_license
puts "hello world" puts "hello again" puts "I like typing this" puts "This is fun!"
true
f9ec4233ada1aaf63583945144bee7094d96104b
Ruby
Airvanne/Ruby_preparcours
/exo_13.rb
UTF-8
108
3.203125
3
[]
no_license
puts "Quelle est votre année de naissance ?" number = gets.to_i number.upto 2018 do |annee| puts annee end
true
bbe91f19341c1688ee3737a35d439e4fec404552
Ruby
gelisam/dotfiles
/bin-todo/subtract
UTF-8
612
3.109375
3
[]
no_license
#!/usr/bin/ruby # Only works if f2 is a strict subset of f1 #f2 = File.open(ARGV[1]) #File.open(ARGV[0]) {|f1| # next_kill = nil # begin # next_kill = f2.readline # rescue EOFError # next_kill = nil # end # f1.each_line {|line| # if line == next_kill # begin # next_kill = f2.readline # re...
true
1562e9c26752deb2d1fc811bab1faa55e7a1d3cf
Ruby
rajmohand/L-99-Ninety-Nine-Lisp-Problems-Solutions-Ruby
/11.rb
UTF-8
341
3
3
[]
no_license
def sort(array) finished = [array.first], i = 0 nw=[] array.each_cons(2) do |(a,b)| if b == a finished[i] << b else finished[i += 1] = [b] end end finished.each do |x| if x.count>1 then nw << [x.first,x.count] else nw << [x.first] end end p nw end data=%w[e...
true
d77d716b14989599888b098c40ef33481d84985f
Ruby
mskeen/adventofcode
/2016/day06/day6.rb
UTF-8
362
2.9375
3
[]
no_license
lines = File.read('./input.txt').split("\n") digits = lines[0].size answer1 = answer2 = '' (0..(digits - 1)).each do |i| # puts i counts = Hash.new(0) lines.each do |line| counts[line[i]] += 1 end # Part a answer1 += counts.sort_by { |k,v| v }.last[0] # Part b answer2 += counts.sort_by { |k,v| v ...
true
03a222ff0dcd288d8c0995e498823437109bcca1
Ruby
DavidLohmann/week4-homework
/app/controllers/weather_controller.rb
UTF-8
533
2.78125
3
[]
no_license
require 'open-uri' # Only the names of classes are capitalized class WeatherController < ApplicationController # This is pulling an html file named search. # File must be in "views" folder then within "weather" folder def search end # @ creates a variable that files in your "views" file can access def co...
true
7718cd2deea5388ec82c0aae9e52dee37ca8b2fb
Ruby
vbrazo/algorithms-archives
/math/power_of_three.rb
UTF-8
1,191
4.5625
5
[]
no_license
# Given an integer n, return true if it is a power of three. Otherwise, # return false. # An integer n is a power of three, if there exists an integer x such # that n == 3^x. # # Approach 1: Loop iteration # # One simple way of finding out if a number n is a power of a number b is to # keep dividing n by b as long a...
true
5e2d734647ad9bed6a6bad29ea28670e9ca56b06
Ruby
balaji-kmty/RB101
/medium_exercises/sides_triangles.rb
UTF-8
763
4.34375
4
[]
no_license
# Write a method that takes the lengths of the 3 sides of a triangle as arguments, and returns a symbol :equilateral, :isosceles, :scalene, or :invalid depending on whether the triangle is equilateral, isosceles, scalene, or invalid. def valid?(tri) max_position = tri.find_index(tri.max) tri.reduce(:+) - tri[max_p...
true
c863391d923771058d44e98d5a671b3f7a395f5f
Ruby
rameshrvr/thorin
/spec/thorin_spec.rb
UTF-8
2,411
2.59375
3
[]
no_license
require 'spec_helper' require 'yaml' # Initialize file path for test yaml files SYNTAX_CHECK_PATH = File.dirname(__FILE__) + '/syntax_check/' USERNAME_CHECK_PATH = File.dirname(__FILE__) + '/verify_username/' RSpec.describe 'Thorin:' do it 'Verification on version number' do expect(Thorin::VERSION).to eq '0.1.0...
true
65d2d1b4a954b56fd01e3bea369a9df729dd4632
Ruby
turboladen/screenplay
/lib/screenplay/part.rb
UTF-8
3,503
3.03125
3
[ "MIT" ]
permissive
class Screenplay # Parts are a simple mechanism for allowing you to create your own grouping of # actions, usually to accomplish some task. Think of it like a script that # you can pass in some options to and call from other scripts. This is # similar to a Puppet Module, Chef Cookbook, or Ansible Playbook. ...
true
445ea2600f8b8399553bae09b2e4ccb84e55ed14
Ruby
rsnorman/weekly_album_anniversaries
/lib/services/account_management/new_twitter_friend_accumulator.rb
UTF-8
792
2.515625
3
[]
no_license
# frozen_string_literal: true require_relative 'twitter_friend_id' module AccountManagement # Collects all new twitter friend accounts class NewTwitterFriendAccumulator def self.all new.all end def initialize(twitter_friend_ids: TwitterFriendId.all, current_follows: TwitterFo...
true
c9b2214a38fec2ee93044377fe0613960e1bc379
Ruby
rubykorea/codingdojo
/2012_10_25/imyostarr&wangsy/spec/discount_oil_spec.rb
UTF-8
546
2.71875
3
[]
no_license
require "spec_helper" require "discount_oil" describe DiscountOil do let(:discount_oil) { DiscountOil.new(75, [20, 40], [90, 80]) } describe "#quick_methods" do # it "test" do # discount_oil.first_method(35).should == 3000 # discount_oil.first_method(100).should == 7900 # discount_oil.second_method(35)...
true
59ae5aba19a848fd664de90de2a1dc6975c5a5e5
Ruby
trbradley/rps-challenge
/lib/computer.rb
UTF-8
225
2.8125
3
[]
no_license
class Computer attr_reader :weapon_choice def initialize(weapons_selection = Game::WEAPONS) @weapons_selection = weapons_selection end def choose_weapon @weapon_choice = @weapons_selection.sample end end
true
d218d9f4d073d39dfd89b7109649c4d1376ef6a0
Ruby
JediMindTricks/WDI
/WDI-Workspace/Week-04/Day-03/intro_to_ruby/first_ruby.rb
UTF-8
209
3.625
4
[]
no_license
# Defining a method then calling it def say_hello name p "Hello World! Nice to meet you " + name end say_hello "Michael" def product a,b return a * b end p product 5,5 i = 0 while i < 10 p i i+=1 end
true
7b1ffdca2d88ecedc7ae8a896ed3c9a2baa316be
Ruby
elitenomad/family-tree
/lib/family/tree/cli.rb
UTF-8
709
2.671875
3
[ "MIT" ]
permissive
module Family module Tree class CLI attr_reader :executor def initialize @executor = Family::Tree::Executor.new end def load(file) if !Family::Tree::ACCEPTED_FORMATS.include?(File.extname(file)) raise Family::Tree::FileFormatNotSupportedError.new end ...
true
9cb5270bc557a0275fcda4bf07dffd9d1fe3a79a
Ruby
greedychipmunk/sieve-of-era
/sieveOfEratosthenes.rb
UTF-8
1,419
4.1875
4
[]
no_license
#!/usr/bin/env ruby # # Playing with the Sieve of Eratosthenes algorithm in Ruby # @author Dawson Blackhouse class Array def getFirstElement self.each { |e| if e != nil return e end } end def getLastElement last = self.reverse return last.getFirstElement end end def secret(number) return numbe...
true
30af0d730374fca1651c3bd2c90534bbc8487460
Ruby
pierrebeaucamp/Exercism-Ruby
/difference-of-squares/difference_of_squares.rb
UTF-8
296
3.453125
3
[ "Unlicense" ]
permissive
class Squares VERSION = 1 def difference square_of_sums - sum_of_squares end def initialize x @x = x end def square_of_sums (@x * (@x + 1) / 2) ** 2 end def sum_of_squares (1..@x).inject do |sum, n| sum + n ** 2 end end end
true
e9d47e28e647af7f610de02c432438f6df959c3d
Ruby
kabligh/boris-bikes
/spec/docking_station_spec.rb
UTF-8
912
2.859375
3
[]
no_license
require 'docking_station' require 'bike' describe DockingStation do describe '#release_bike' do it { is_expected.to respond_to(:release_bike) } it 'raises an error when no bikes available' do expect { subject.release_bike }.to raise_error "No bikes available" end end # describe '#working?'...
true
f73434b4500dc7e6a310ac9d25582a2af9ddbf9e
Ruby
ccallebs/Moon-Critter
/lib/map_tile.rb
UTF-8
694
3.046875
3
[]
no_license
require 'gosu' require './lib/map_tiles/type' class MapTile HEIGHT = 50 WIDTH = 50 attr_accessor :window, :type, :x, :y def initialize(window, raw_type, x = 0, y = 0) @window = window @type = MapTiles::Type.new(raw_type) @image = Gosu::Image.new(@window, @type.image_path, false) if @type.has_image...
true
f8325d8062f6fbebec929c733b8b22fb7619b963
Ruby
michaela260/slack-cli
/test/user_test.rb
UTF-8
1,891
2.9375
3
[]
no_license
require_relative 'test_helper' describe 'class user' do let(:user){Slack::User.new(id: "USLACKBOT", name: "slackbot", real_name: "Slackbot", status_text: "Print is dead", status_emoji: ":books:")} describe 'initialize' do it 'creates a new instance of User' do expect(user).must_be_instance_of Sl...
true
1c41fe29c6b7da3e76babad21dd44a9a96d0b1a0
Ruby
tschaffer1618/module_0_capstone
/day_3/else_and_if.rb
UTF-8
658
4.1875
4
[]
no_license
people = 30 cars = 40 trucks = 15 if cars > people puts "We should take the cars." elsif cars < people puts "We should not take the cars." else puts "We can't decide." end if trucks > cars puts "That's too many trucks." elsif trucks < cars puts "Maybe we could take the trucks." else puts "We still can't ...
true
274d0056bd9ebbb3fb141ccd8a033a54528105cc
Ruby
mashiro/enver
/lib/enver/loader.rb
UTF-8
1,875
2.8125
3
[ "MIT" ]
permissive
require 'ostruct' module Enver class Loader attr_reader :attributes def initialize(env, prefix = '', &block) @env = env @prefix = prefix @attributes = OpenStruct.new instance_eval(&block) if block end def value(*args) options = extract_options! args has_default =...
true
1955cd8a35472377d7f8807d6715d269c62d8a57
Ruby
Pi-hils/process_review
/leetcode/spec/robot_spec.rb
UTF-8
453
2.90625
3
[]
no_license
require 'robot' describe Robot do context "a robot starts from the origin and makes its movement, find out if it ends back to the origin" do #| "UD" | True #At Origin, 0,0| it 'starts from an origin and moves to the up, then down, does it return to origin?' do expect(subject.movement("UD")).to be true ...
true
9cc910376fd9f1453fadf127f9332a212b1c60ac
Ruby
ChicksEater/COS10009-Introduction-to-Programming
/projects/2.2T-Functions/hello_user_with_functions.rb
UTF-8
1,219
4.125
4
[]
no_license
require 'date' require './input_functions' # Multiply metres by the following to get inches: INCHES = 39.3701 # Insert into the following your hello_user code # from task 1.3P and modify it to use the functions # in input_functions def main() # HOW TO USE THE input_functions CODE # Example of how to read string...
true
430a79d4c3538639d5a76587f089c59aae9faef5
Ruby
rove-rb/rove
/lib/rove/package.rb
UTF-8
1,501
2.578125
3
[ "MIT" ]
permissive
module Rove class Package < Option include Support::Storer attr_reader :settings class << self def [](id) id = id.to_sym; Package.all.select{|x| x.id == id}.first end end def [](id) id = id.to_sym; @settings.select{|x| x.id == id}.first end def initialize(id, ...
true
852768b115ac47dacb16fded20c546f072cfc490
Ruby
onosi/math_puzzle_1
/q17.rb
UTF-8
218
3.625
4
[]
no_license
@number = 30 @male, @female = "m" , "f" def add(seq) return 1 if seq.size == @number count = add(seq + @male) count += add(seq + @female) if seq[-1] == @male count end puts add(@male) + add(@female)
true
d732e04d4836592adef7c341dee4b64a25b5bd19
Ruby
cheif/RemotePlay
/server.rb
UTF-8
620
2.890625
3
[]
no_license
require 'rubygems' require 'em-websocket' require 'mediaplayer' puts "Starting server" soundcloudURL = Regexp.new(/soundcloud.com*/); youtubeURL = Regexp.new(/youtube.com\/watch\?*/); player = Mediaplayer.new EventMachine::WebSocket.start(:host => '0.0.0.0', :port => 2011) do |ws| ws.onopen { ws.send "Hello Cli...
true
54d80657ac6da72ccee6217ebd32c93e61a53a23
Ruby
jamiehodge/crdt
/lib/crdt/g_counter.rb
UTF-8
455
2.78125
3
[]
no_license
module Crdt module GCounter extend self def create Hamster.hash end def increment(counter, delta, node = Crdt.node) counter.put(node) {|v| v.to_i + delta.to_i } end def merge(counter, other) array = (counter.keys | other.keys).map do |key| [key, [counter[key].to_i,...
true
b59ee44b4660b1be97bb2d39c7d1b9e307f1d91f
Ruby
birkirb/hue-lib
/lib/hue/config/abstract.rb
UTF-8
1,571
2.984375
3
[]
no_license
require 'yaml' require 'fileutils' module Hue module Config class NotFound < Hue::Error; end; class Abstract public attr_reader :path, :name def initialize(name, path) @path = path @name = name self.class.setup_file_path(self.path) end def write(overw...
true
040ebba6847fcf69055a6de6159b55afa87f86b9
Ruby
Maxcutex/rubypractice
/hangman/lib/hangman.rb
UTF-8
4,262
3.3125
3
[]
no_license
class Hangman def initialize @secret_word = get_random_word @word_array = @secret_word.downcase.split("") @current_display = ('_' * @word_array.length).split("") # Array.new(@word.size, "_") @guesses_remaining = 6 @valid_guesses = ('a'..'z').to_a @previous_guesses = [] startoption end ...
true
e735ce7882db9111d9dd96e6a7ec0a2ac0c5f3e5
Ruby
blackbirdco/wit-ruby2
/lib/wit/result.rb
UTF-8
512
2.625
3
[ "MIT" ]
permissive
module Wit class Result attr_reader :id, :text, :intent, :confidence, :entities def initialize(hash) @id = hash['msg_id'] @text = hash['_text'] outcomes = hash['outcomes'].first if outcomes @intent = outcomes['intent'] @confidence = outcomes['confidence'] @enti...
true
cbf5e3b608778afc2bb9a1710c5267dcd3cd1727
Ruby
lcloyola/upis-ror
/app/models/section.rb
UTF-8
887
2.59375
3
[]
no_license
class Section < ActiveRecord::Base validates_inclusion_of :year, :in => -3..12, :message => "can only be from -2 and 12." validates_numericality_of :year, :only_integer => true, :message => "can only be whole number." validates_uniqueness_of :name, :scope => [:schoolyear_id] validates_presence_of :schoolyear_id...
true
c993063bdcb6ffec6d13cd10a345eaabb7d72555
Ruby
IsaacYung/collection-patterns
/adapter/adapter.rb
UTF-8
1,257
4.3125
4
[]
no_license
# Let's think of a class that takes two open files (a reader and a writer) and encrypts a file. class Encrypter def initialize(key) @key = key end def encrypt(reader, writer) key_index = 0 while not reader.eof? clear_char = reader.getc encrypted_char = clear_char ^ @key[key_index] ...
true
078dd1e84b943b3ae3982789bc9ecf0a14239c05
Ruby
easing/evotest
/app/operations/create_status.rb
UTF-8
1,140
2.6875
3
[]
no_license
# frozen_string_literal: true ## # Создаёт запись в журнале состояний class CreateStatus # Создаёт запись в журнале состояний, если новое состояние хоста отличается от текущего # # @param [String] hostname # @param [String] status_type # @param [String] message # @return [Status] def self.call(hostname, ...
true
fc67685f46f8be3eaceec1540505658991701c2a
Ruby
holmesm8/ruby-exercises
/objects-and-methods/exercise-1/lib/bag.rb
UTF-8
299
3.578125
4
[]
no_license
class Bag attr_reader :count, :candies def initialize @count = 0 @candies = [] end def add_candy(candy) @candies << candy @count += 1 end def empty? true if @candies.length == 0 end def contains?(type) @candies.find {|candy| candy.type == type} end end
true
dcb64584abb4a0277f6363ae8230eb92ebf9922a
Ruby
jetthoughts/redminetk
/CronManager.rb
UTF-8
10,490
3.21875
3
[]
no_license
require 'tk' require 'CronJobMgr' ############################################################################### # Class: CronManager # This class provides the GUI interface to the CronJobMgr class. It is the # view and controller objects of the MVC paradigm. ######################################################...
true
70d3e45b2d2929dc1a4291ef605f5ddfbe76584e
Ruby
ssteeg-mdsol/openapi3-generator
/gems/gems/prawn-table-0.2.2/manual/table/content_and_subtables.rb
UTF-8
1,488
3
3
[ "GPL-3.0-only", "GPL-2.0-only", "Ruby", "Apache-2.0" ]
permissive
# encoding: utf-8 # # There are five kinds of objects which can be put in table cells: # 1. String: produces a text cell (the most common usage) # 2. <code>Prawn::Table::Cell</code> # 3. <code>Prawn::Table</code> # 4. Array # 5. Images # # Whenever a table or an array is provided as a cell, a subtable will be...
true
41b47d826232f02648389b3cdda9d473ef382d39
Ruby
DrDrakula/module-one-final-project-guidelines-web-121117
/lib/models/command_line_interface.rb
UTF-8
14,024
3.109375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' require 'colorize' arter = Artii::Base.new puts arter.asciify("welcome").colorize(:blue) def welcome puts "Welcome to our group project. We hope you enjoy!".colorize(:light_yellow) end def user_input print "Input Here: " input = gets.chomp input.to_s end ################################# MAIN M...
true
083682f919fd6958182316aff108f2b7e7338168
Ruby
antloewe/sudokusolver
/Block.rb
UTF-8
2,168
3.640625
4
[]
no_license
#encoding: UTF-8 # Klasse zum Darstellen von 3×3-Blöcken class Block # Erstellt einen Block. Nicht vorhandene Argumente werden mit Nullen (d. h. nicht gesetzt) aufgefüllt def initialize *args length = 3 abort "Zu viele Argumente!" if args.length > length ** 2 # Initialisiert Reihen-, Spalten- und Elemente-...
true
891754c08181825e0307cf865b4831c0d12b9e32
Ruby
mkrahu/launchschool
/exercises/small_problems/vers1/medium_1/1000_lights.rb
UTF-8
491
3.71875
4
[]
no_license
# 1000_lights.rb # 100 Lights exercise # Small Problems exercises from LaunchSchool def toggle_light(lights, n) lights[n] = !lights[n] end def n_lights(num) lights = [] num.times { lights << false } 1.upto(num) do |i| 0.upto(num - 1) do |n| toggle_light(lights, n) if ((n + 1) % i).zero? end en...
true
dd47b118de1ae4e36fa4f7c11f9620985c40ca1e
Ruby
waltersharpWEI/ruby_stock
/main.rb
UTF-8
265
2.5625
3
[ "MIT" ]
permissive
#!/usr/bin/ruby require_relative 'utils/dao_stock.rb' stock1 = Stock.new('data/stock.json',0) while true for i in 1..100000000 stock1.buyGood('Apple', 15) stock1.buyGood('Orange', 8) stock1.sellGood('Apple', 6) stock1.saveStock() end end
true
a8cb0517a7490ac9c0af23fad054bfbe9354cfd7
Ruby
Maheshkumar-novice/Mastermind
/archives/computer-player-knuth.rb
UTF-8
734
2.984375
3
[]
no_license
#!/usr/bin/env ruby # frozen_string_literal: true require_relative './player' require_relative './knuth' require_relative './modules/display' module Mastermind # Human Player Class class ComputerPlayer < Player include Display attr_accessor :current_guess, :guess def initialize super('Computer'...
true
09eaaa528ab1dec9fec5140e29eae389b5df3a71
Ruby
bingxie/code-questions
/lib/leetcode/695_max-area-of-island.rb
UTF-8
1,011
3.40625
3
[ "MIT" ]
permissive
# number of islands的变种 # @param {Integer[][]} grid # @return {Integer} def max_area_of_island(grid) sizes = num_islands(grid) sizes.empty? ? 0 : sizes.max end def num_islands(grid) return [] if grid.empty? sizes = [] 0.upto(grid.size - 1) do |i| # (grid.size -1).times 0.upto(grid.first.size - 1) do |j...
true
9573e8fa7dddeccea8e045934cad5feb770efd3d
Ruby
jasondi/lita-ignore-me
/lib/lita/handlers/ignore_me.rb
UTF-8
2,396
2.578125
3
[ "MIT" ]
permissive
module Lita module Handlers class IgnoreMe < Handler include IgnoreRegistry route(/^ignore me$/i, :ignore_me, command: true, help: { "ignore me" => t('ignore_help') }) route(/^ignore me in (.+)$/i, :ignore_me_in_room, command: true, help: { "ignore me in #room" => t('ign...
true
2ee7c73f13e780f9035619c9f414b5049284fb29
Ruby
jamesfwz/evaluation-tests
/rails-test-6/app/models/mother.rb
UTF-8
109
2.859375
3
[]
no_license
class Mother < Parent include Person::Female def say_something 'Hello, I am your mother.' end end
true
f2417e391f2240f340d1de5a451cb9263a5b44fd
Ruby
ochko/prudge
/db/migrate/20130623065520_create_participants.rb
UTF-8
1,208
2.546875
3
[ "MIT" ]
permissive
class CreateParticipants < ActiveRecord::Migration def up create_table :participants do |t| t.integer :contest_id , :null => false t.integer :user_id , :null => false t.integer :rank t.float :points , :default => 0.0 end connection.select_values("SELECT id FROM contests")...
true
d1aa39d2568de5a73a5192a1d221057679af5237
Ruby
Argonus/codility_others
/coderbyte/easy/first_reverse.rb
UTF-8
94
3.109375
3
[]
no_license
def FirstReverse(str) str.reverse! return str end puts FirstReverse("abcde")
true
db2168aea2309681c44201ddac38af02f4a5e851
Ruby
capveg/sidecar
/ip2ttls2db/calc-ipdistance.rb
UTF-8
6,313
2.890625
3
[]
no_license
#!/usr/bin/ruby # usage: calc-ipdistance.rb foo.adj table # 1) takes an adj file and DB table name # 2) foreach link in foo.adj # look up the ips of endpoints, calc their distance # and print UsageString='usage: calc-ipdistance.rb table [-adj foo.adj| -pairs thresholddistance | -rand k_times | -randThre...
true
c4cb68dca0dad271a6bd3eda2c500898e1d25cd5
Ruby
kcartlidge/ruthless
/ruthless.rb
UTF-8
15,097
2.84375
3
[ "MIT" ]
permissive
#!/usr/bin/ruby # puts 'Ensuring dependencies (slower first time).' require 'fileutils' require 'find' require 'set' require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'inifile' gem 'kramdown' gem 'liquid' gem 'webrick' end # Get the command arguments. @new_site = (ARGV[0] && (ARGV[0] == '...
true
cababf1ebf5fccbcbc70885ed2e36784ba729541
Ruby
alemohamad/book-of-ruby
/11 - Symbols/allsymbols.rb
UTF-8
325
3.78125
4
[]
no_license
# The Book of Ruby - http://www.sapphiresteel.com p( Symbol.all_symbols ) puts( p( Symbol.all_symbols.length ) ) # shows number of symbols in Ruby p( Symbol.all_symbols[0,10] ) # p [:a,:c,:b].sort #<= can't sort symbols in Ruby 1.8! Works in 1.9 str_arr = Symbol.all_symbols.collect{ |s| s.to_s } puts( str_arr.s...
true
96f910b9c229a5be902ef81b0b79823d5e449f71
Ruby
zakkoltun/101_foundations
/small_problems_ex/easy_4/ex9.rb
UTF-8
459
3.84375
4
[]
no_license
DIGITS = { 0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9' } def get_digit_place(num, place) (num % (place*10)) / place end def integer_to_string(int) digits = [] while int >= 0 digits << DIGITS[int % 10] int = int / 10 ...
true
16039d7793810d95dfca35ad6882150a77bf7691
Ruby
touhidur-rahaman/Ruby-Practice
/Ruby/Animals.rb
UTF-8
54
2.671875
3
[]
no_license
class Animals def initialize(n) @head=n end end
true
7f7c8941d6aa8693914bffd449d844ddc52b179a
Ruby
tiagolupepic/freepass
/api/app/filters/hour.rb
UTF-8
450
2.8125
3
[ "MIT" ]
permissive
class HourFilterParams attr_reader :params def initialize(params) @params = params end def result valid_params.delete_if { |_, value| value.nil? } end private def valid_params { name: params[:name], start_at: params[:start_at], end_at: params[:end_at], days: ...
true
e6807ed4fdeb36677a49c2fee5947d7fbe952708
Ruby
lbvf50mobile/til
/20190813_Tuesday/tests/conditional_instructions.rb
UTF-8
1,312
3.21875
3
[]
no_license
describe "Befunge-93 Conditional Instructions" do # https://coolefriend.com/know-names-of-symbols-in-your-computer-keyboard/ it "_: pop a value; move right if value = 0, left otherwise" do # _: pop a value; move right if value = 0, left otherwise: underscore state = {stack: [1], direction: 'lef...
true
3e1b8146957c530a917b0e5b5178977b956c54b3
Ruby
zmachine82/library-code
/csv_client.rb
UTF-8
564
3.375
3
[]
no_license
class CsvClient def initialize(file) @file = file end def read_file File.readlines(@file) end def append(line) File.open(@file, "a") do |file| file.puts line end end def write_to_file(lines) File.open(@file, "w") do |file| f...
true
d603679c810e4105d77a532f9db2c67533df7082
Ruby
guinus70/tests-rubys
/lib/01_temperature.rb
UTF-8
147
3.140625
3
[]
no_license
def ftoc(tempe) tempeC = (tempe - 32)/1.8 return tempeC.round(1) end def ctof(tempe) tempeF = tempe*1.8 + 32 return tempeF.round(1) end
true
fa23e69658c66ed644d40dae9f079f5696ef5773
Ruby
cliftondavies/HackerRank
/Ruby/divisible_sum_pairs.rb
UTF-8
776
3.734375
4
[ "MIT" ]
permissive
# https://www.hackerrank.com/challenges/divisible-sum-pairs/problem def divisibleSumPairs(n, k, ar) # problem domain = integers and arrays # inputs: array length, divisor, array of n integers # store/track = index # process/algorithm = add each integer with all following integers, increment number of pairs if ...
true
be9f4af9a7ba8633fd3217123f1057cb8b87a600
Ruby
BaptisteVeyssiere/208dowels
/208dowels
UTF-8
4,872
3.1875
3
[]
no_license
#!/usr/bin/ruby -w # coding: utf-8 require 'csv' if ARGV[0] == "-h" print "USAGE\n\t\t./208dowels O0 O1 O2 O3 O4 O5 O6 O7 08+\n\nDESCRIPTION\n\t\tOi\tsize of the observed class\n" exit(0) end if ARGV.length != 9 print "Program needs 9 arguments: got #{ARGV.length}\n" exit(84) end for i in 0..8 if ARGV[i] !~...
true
97d4a1d41fca3a08856d4587f261dc79c665d24e
Ruby
Maravk/EmilieMaraPTP
/EmilieMaraPTP/A03/kreis.rb
UTF-8
3,293
3.3125
3
[]
no_license
require_relative 'punkt' require_relative 'leinwand' require_relative 'einstellungen' # Author:: Birgit Wendholt # Author:: Bernd Kahlbrandt, an Ruby Style Guide angepasst. class Kreis # initialize wird aufgerufen, wenn Instanzen der Klasse erzeugt werden # '@xxxx' sind die Instanzvariablen der Instanzen def i...
true
eec88cde0b0073db03c55766cbdc584b5a5f2af4
Ruby
ty-doerschuk/phase-0
/week-4/factorial/my_solution.rb
UTF-8
415
3.859375
4
[ "MIT" ]
permissive
# Factorial # I worked on this challenge [by myself, with: ]. # input integer to get factorial number via method # define factorial(number) # assign sum = 1 # use correct loop to count down # sum * number = new sum # number = number - 1 # loop that back through # end method # return sum # Your Solution Below def fac...
true
4d1a2cd96b5c82863a61db38c3ff96f4ea9ef676
Ruby
upfluence/sensu
/lib/sensu/utilities.rb
UTF-8
2,533
2.9375
3
[ "MIT" ]
permissive
gem "uuidtools", "2.1.5" require "uuidtools" module Sensu module Utilities # Determine if Sensu is being tested, using the process name. # Sensu is being test if the process name is "rspec", # # @return [TrueClass, FalseClass] def testing? File.basename($0) == "rspec" end # Retry ...
true
22beef913d65a546b8159e474a5a68688f2b0fba
Ruby
Erawpalassalg/CoursAlgo
/TD11/Exo5.rb
UTF-8
629
3.890625
4
[]
no_license
#encoding: utf-8 =begin fonction Puissance(x, p : Entier) → Entier // La fonction puissance(x,p) renvoie l'entier représentant le nombre x à la pussance p Lexique de Puissance x, p : Entier // paramètres fonctionnels, le nombre renvoyé représente x à la puissance p Algorithme de Puissance ...
true
d7a57b2e66375405376a5c45d01d1256759112b9
Ruby
WodaKyon/RGSS
/Game Scripts/世紀之卡(Carte-De-Sentinelle)/Scripts/004 - Cache.rb
UTF-8
5,700
2.875
3
[ "Apache-2.0" ]
permissive
#encoding:utf-8 #============================================================================== # ■ Cache #------------------------------------------------------------------------------ # 處理載入圖像,建立/儲保 Bitmap 物件。為加快載入速度和節省內存, # 此模塊將建立的 bitmap 物件保存在內部哈希表中,令程序要再次處理 #  相同的圖像時能快速讀取。 #======================================...
true
5e234e1e1a09d6c756851250d8911563d28165c8
Ruby
alinemokfa/e16_class_notes
/week_03/day_3/one_to_many_pizza_shop/one_to_many_pizza_end/pizza_shop/db/console.rb
UTF-8
666
2.65625
3
[]
no_license
require('pry-byebug') require_relative('../models/pizza_order') require_relative('../models/customer') PizzaOrder.delete_all() Customer.delete_all() customer1 = Customer.new({'name' => 'Craig Morton'}) customer2 = Customer.new({'name' => 'David Blaine'}) customer1.save() customer2.save() order1 = PizzaOrder.new({ ...
true
03c81e11d9a87231be758524a2999ddc17e8ff15
Ruby
yoyohohoxd/learn_ruby
/03_simon_says/simon_says.rb
UTF-8
913
4.375
4
[]
no_license
#write your code here def echo(string) string end def shout(string) string.upcase end def repeat(string, a = 2) if a <= 2 string + ' ' + string elsif a > 2 repeat_word = string + ' ' full_output = repeat_word * a full_output.delete_suffix(' ') end end def start_of_...
true
b41a1dcd1061b4a9c89bcf5143b269fe456f8ac0
Ruby
JFVF/cucumber_022015
/Noemi/Arry_practice.rb
UTF-8
590
3.859375
4
[]
no_license
class My_arry def drawn_arry() puts 'Give me the lenght of the arry?' @var_number = gets.chomp.to_i puts "The leght is #{@var_number}" ary = Array.new Array.new(@var_number) for i in 1.. @var_number puts 'Give me a item to add to arry?' var_item=gets.chomp ary.push var_item end return ary ...
true
f70cf70f55320f52b986199447862797cf7549df
Ruby
OskarRamirez/101
/lesson_3/practice_problems_medium_2.rb
UTF-8
744
3.765625
4
[]
no_license
#3 =begin Prints "My string looks like this now: pumpkins" prints "My array looks like this now: ["pumpkin","rutabaga"]" #4 prints "My string looks like this now: pumpkinsrutabaga" prints "My array looks like this now: ["pumpkins"] =end def tricky_method_two(a_string_param, an_array_param) a_string_param << 'rutab...
true
25bf9924527971d59919c5fb14d0362c455c4fd0
Ruby
jroberts235/utils
/diff_env
UTF-8
3,824
2.890625
3
[]
no_license
#!/usr/bin/env ruby require 'colorize' # gem install 'colorize' # accept nil for environment and show all env's if ARGV[0] == nil arg1 = nil else arg1 = ARGV[0] end raise "Knife can't be found at '/usr/bin/knife'".red unless File.exist?('/usr/bin/knife') environment = arg1 mismatches = 0 user_name = `whoa...
true
18e920a7d0c0d1d073817d20f239444ca41721c3
Ruby
Stro21/E9CP1A1
/ejercicio5.rb
UTF-8
692
4.09375
4
[]
no_license
# Class Morseable class Morseable def initialize(number) @number = number end def generate_hash(number) if number >= 0 && number <= 4 hash_minus(number) else hash_point(number) end end def hash_minus(number) h = '-----' return h if number.zero? i = 0 h.each_char ...
true
3cf1ee204603c4209f650f3b6891f3eafdcf6c90
Ruby
shsachdev/ls101
/small_problems/medium_problems/rotation_pt2.rb
UTF-8
507
3.59375
4
[]
no_license
def rotate_rightmost_digits(number, n) if n == 1 return number end number_array = number.to_s.chars deleted_num = number_array.delete_at(-n) number_array << deleted_num number_array.join.to_i end # p rotate_rightmost_digits(735291, 1) == 735291 # p rotate_rightmost_digits(735291, 2) == 735219 # p rotat...
true
2b201bb32626ce18593534bbe6a1361a2691b8da
Ruby
sookoor/ruby-practice
/even_fibonacci_sum.rb
UTF-8
211
3.234375
3
[]
no_license
def even_fibonacci_sum sum, prev, cur if sum < 4000000 if cur % 2 == 0 sum += cur end even_fibonacci_sum sum, cur, prev + cur else return sum end end puts even_fibonacci_sum 0, 1, 2
true
38ec443d9afab097dc8e4ebaecb4c9141e8383a6
Ruby
smile0304/ufuzz
/lib/ufuzz/tokenizer.rb
UTF-8
1,310
3.046875
3
[]
no_license
module UFuzz class Tokenizer attr_accessor :tokens def initialize(str) @tokens = [] @regex = /[@"\/\:=\[\]&,\r\n\|;\*\?\)\(\{\}\\ ]/ prev = '' (0).upto(str.length-1) do |n| if str[n] =~ @regex @tokens << prev unless prev.empty? @tokens << str[n] prev = '' ...
true
99f9c7f7dbdfe97d8b8fc4c7fee94d7891a0180a
Ruby
fizzy-fifs/makersbnb
/spec/booking_spec.rb
UTF-8
894
2.59375
3
[]
no_license
require 'booking' require 'user' require 'space' describe Booking do let(:user) {User.create(name: "John" , email: "jman@user.com", password: "password123")} let(:space) {Space.create(name: "10 Makers Lane", description: "Nice house", price_per_night: "10", user_id: user.id) } let(:booking) { Booking.create(star...
true
aa01f2bee1dae3fe44361eb2045c18623032dfc7
Ruby
chefzyz/BAREALTY
/main.rb
UTF-8
617
2.53125
3
[]
no_license
require 'sinatra' get '/index' do erb :index end get '/contact' do erb :contact end get '/find' do erb :find end get '/sell' do erb :sell end post '/contact' do require 'mandrill' m = Mandrill::API.new message = { :subject=> params[:subject], :from_name=> params[:name], :text=> params[:message] + "Y...
true
e331607c3fdca0dc6aae76bc09a2ed221852428c
Ruby
aiya000/workspace
/Coder/paiza/Challenge/Rank_C/C016/54.rb
UTF-8
278
3.4375
3
[]
no_license
class String MAP = { "A" => "4", "E" => "3", "G" => "6", "I" => "1", "O" => "0", "S" => "5", "Z" => "2" } def replace_to_leef self.split("").map{|c| _c = MAP[c]; if _c == nil then c else _c end }.join end end puts gets.replace_to_leef
true
3c4f25b03aaf206b4a26b04cd975d91fa8cb4707
Ruby
hectoregm/pingpong
/spec/models/game_spec.rb
UTF-8
1,874
2.625
3
[]
no_license
require 'rails_helper' RSpec.describe Game, type: :model do before do @valid_attributes = { played_at: Time.now, winner: User.create!(email: 'foo@regalii.com', password: 'secret123'), loser: User.create!(email: 'bar@regalii.com', password: 'secret456'), ...
true