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
03effa0098e14240cabb5a2959057070ac1f8b6e
Ruby
antoineLeclercq/code_challenges
/ruby/permutations_II.rb
UTF-8
691
3.28125
3
[]
no_license
# @param {Integer[]} nums # @return {Integer[][]} def permute_unique(nums) result = [] nums.sort! permute_unique_helper(nums, result, [], Array.new(nums.size, false)) result end def permute_unique_helper(nums, result, solution, nums_status) if solution.size == nums.size result << solution....
true
9e1c46359cae53851c3a9a5f6412ee55de999d8c
Ruby
peterhuene/puppet-ruby-host
/spec/unit/options_spec.rb
UTF-8
4,001
2.59375
3
[ "Apache-2.0" ]
permissive
require 'spec_helper' require 'puppet-ruby-host/options' describe PuppetRubyHost::Options do subject { PuppetRubyHost::Options } before :all do @tmpdir = Dir.mktmpdir end after :all do FileUtils.remove_entry @tmpdir end describe 'parsing options' do it 'should parse empty options' do ...
true
8881e5af9ad3febfe3fe308be3232a0f17629569
Ruby
vickishan/code_camp
/code_camp/app/models/location.rb
UTF-8
410
2.9375
3
[]
no_license
# l = Location.create(...) # l.truck # Location.find_by(...) class Location < ActiveRecord::Base belongs_to :truck validates :day_of_week, presence: true, inclusion: { in: 0..6 } # [0,1,2,3,4,5,6] validates :start_hour, :end_hour, presence: true, inclusion: { in: 0..23 } validates :lat, presence: true, inclu...
true
f483a82e3acf99b86b816fc236e6ff9bb39f4028
Ruby
johnjvaughn/ls_course_130
/Challenges/Advanced1/queen_attack.rb
UTF-8
1,055
3.765625
4
[]
no_license
class ArgumentError < StandardError; end class Queens BOARD_DIMENSION = 8 WHITE_TOKEN = 'W' BLACK_TOKEN = 'B' EMPTY_TOKEN = '_' attr_reader :white, :black def initialize(positions = { white: [0, 3], black: [7, 3]} ) @white = positions[:white] @black = positions[:black] validate end def ...
true
bd1333f8b2d7bdb58d7f31ebf46611c9fa1c0d34
Ruby
sti-ipf/alfa
/app/models/presence.rb
UTF-8
2,221
2.640625
3
[]
no_license
class Presence < ActiveRecord::Base belongs_to :lecture_day belongs_to :student belongs_to :room NO_CLASS = 0 WITH_CLASS = 1 ACTIVE = 2 AWAY = 3 EVADED = 4 STUDENT_STATUS = [["Frequente", ACTIVE], ["Ausente", AWAY], ["Evadido", EVADED]] def self.create_presences(params = {}) @lecture_days = L...
true
c9e845cbdd8d01ff3d191697978b2ccc8d8a0e4e
Ruby
tylorschafer/m3_assessment_2
/app/facades/search_show_facade.rb
UTF-8
819
2.765625
3
[]
no_license
class SearchShowFacade def initialize(origin) @origin = origin end def station nearest_station = FuelStationService.new(origin).nearest_electic_station Station.new(nearest_station) end def navigation find_directions = GoogleDirectionsService.new(origin, station.street) .directions_to_...
true
5bbffb1bcc1977f7ab865af8808f586f386c061b
Ruby
cul/cul_image_props
/lib/cul_image_props/image/properties.rb
UTF-8
1,355
2.609375
3
[]
no_license
require 'cul_image_props/image/properties/version' require 'cul_image_props/image/properties/types' require 'cul_image_props/image/magic' require 'open-uri' module Cul module Image module Properties def self.identify(src) if src.is_a? String src = open(src) end filesize = src.stat.size result =...
true
f3bf2f03fb5e5db07cf11c01934d0d447958fc4c
Ruby
rvelarden/tic-tac-toe-rb-ruby-apply-000
/lib/tic_tac_toe.rb
UTF-8
2,097
4.03125
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
WIN_COMBINATIONS = [ [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [2,4,6] ] def display_board(board) puts (" #{board[0]} | #{board[1]} | #{board[2]} ") puts ("-----------") puts (" #{board[3]} | #{board[4]} | #{board[5]} ") puts ("-----------") puts (" #{bo...
true
882f2300a6204e784bc69dc82bc0c69397988799
Ruby
stevenb-nz/AdventOfCode2015
/day11/aoc11.rb
UTF-8
870
3.53125
4
[ "MIT" ]
permissive
def increment input pos = 7 while input[pos] == 'z' input[pos] = 'a' pos -= 1 end if pos >= 0 input[pos] = input[pos].next input[pos] = input[pos].next if ['i','o','l'].include? input[pos] end return input end def valid input valid = true valid = false if input.include? 'i' valid = fa...
true
c7f020a5545e4d1af48e2c087628e69facde87de
Ruby
skandow/ruby-oo-relationships-practice-blood-oath-exercise-chi01-seng-ft-051120
/app/blood_oath.rb
UTF-8
851
3.328125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
p "*" * 25 p "running 'blood_oath.rb'" class BloodOath attr_reader :cult, :follower, :initiation_date @@all = [] def initialize(cult, follower, initiation_date) @cult = cult @follower = follower @initiation_date = initiation_date @@all << self end def self.a...
true
6af391023df59d2f6d9dad8f06e067f7db8cd1db
Ruby
veetow/adventofcode
/2020/day-2/1.rb
UTF-8
357
2.90625
3
[]
no_license
valid = 0 IO.foreach('input') do |line| policy, password = line.chomp.strip.split(':') password.strip! policy = policy.split required_char = policy.last min, max = policy.first.split('-') min = min.to_i max = max.to_i found = password.scan(required_char).length if found >= min and found <= max then ...
true
6a4703068abbf0b521230953443c418fb0d8a016
Ruby
GeorgeDewar/rotabot
/test/models/week_test.rb
UTF-8
675
3.109375
3
[]
no_license
require 'test_helper' class WeekTest < ActiveSupport::TestCase test "gets current week right" do Date.stubs(:today).returns(Date.new(2017,4,1)) this_week = Week.this assert_equal "2017-03-27", this_week.start_date.to_s assert_equal "2017-04-02", this_week.end_date.to_s # week number is correct ...
true
cde31ac4b9074fac6208cc94f6e9f539f4ddf77d
Ruby
kubicue/BEWDHW
/src/bewd_homework/class_3_4_homework/leapyrs.rb
UTF-8
489
3.640625
4
[]
no_license
puts "Welcome to leap year finder" puts "Please type starting year." start_yr = gets.chomp.to_i puts "Please type an ending year." end_yr = gets.chomp.to_i puts "Leap years in between #{start_yr} and #{end_yr}:" while (start_yr <= end_yr) do if start_yr % 4 == 0 if start_yr % 400 == 0 puts "#{s...
true
9a545cc07cc92378d2f71b4888d9345a08a55a55
Ruby
silviachung/history-of-sushi-api
/lib/tasks/db.rake
UTF-8
3,725
2.6875
3
[]
no_license
require 'csv' require 'date' require_relative '../data/basic' require_relative '../data/appreciation' require_relative '../data/above_average' require_relative '../data/show_off' require_relative '../data/photos' namespace :db do namespace :seed do desc "Import User CSV to create users and destroy previous" ...
true
d35a280daaeab4c04830d951eb3ffaf56ed6755a
Ruby
bradphelan/acts_as_challenged
/lib/acts_as_challenged/base.rb
UTF-8
2,197
2.921875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'squeel' module ActsAsChallenged module Base def acts_as_challenged send :include, ActsAsChallenged::InstanceMethods extend ActsAsChallenged::ClassMethods has_many :challenges, :class_name => ActsAsChallenged::Challenge has_many :won_challenges, :class_name => ActsAsChallenged::C...
true
e1495582ac046a4f16c25d01aa665e5128d75ed9
Ruby
vsavkin/jruby_ast_transformations
/lib/file_to_transform.rb
UTF-8
76
3.09375
3
[]
no_license
class MyClass def my_method name, age puts name puts age end end
true
4051a9b936f3b0013a3a4dc9b56d76ada3044a7a
Ruby
yusuketsuiki/euler
/17.rb
UTF-8
1,326
3.765625
4
[]
no_license
def get_number(num) base_count = {1 => 3, 2 => 3, 3 => 5, 4 => 4, 5 => 4, 6 => 3, 7 => 5, 8 => 5, 9 => 4, 0 => 0} keta_count = {2 => 4,3 => 4, 4 => 4, 5 => 3, 6 => 3, 7 => 5, 8 => 4, 9 => 4} numlen = num.to_s().length sum = 0 if numlen == 1 sum = base_count[num] elsif numlen >= 2 # 下二桁を判定 simo1 = num.to_...
true
21988064d0e7a17a284b5845378fde101fbb3f70
Ruby
chemunoz/Ironhack
/ClassExercises/WEEK2/DAY1/fizzbuzz_tdd.rb
UTF-8
2,069
3.75
4
[]
no_license
#FIZZ BUZZ require 'rspec' class FizzBuzz def calc(number) if number%3==0 && number%5==0 && number>0 "FizzBuzz" elsif number%3==0 && number>0 "Fizz" elsif number%5==0 && number >0 "Buzz" else number end end #REFACTOR def calc_refact(number) result="" if numb...
true
9df6e964fcb7d4040eb134d8ae51fdcd6e09d728
Ruby
nyaago/cms
/app/models/blog_article.rb
UTF-8
2,378
3.015625
3
[]
no_license
# = BlogArticle # Blog記事のモデル. # 記事(Article)モデルからの継承 class BlogArticle < Article # 年月を保持するオブジェクト class Month attr_reader :year, :month def initialize(year, month) @year = year @month = month @datetime = DateTime.new(year, month) end def to_s(format = '%Y-%m') @...
true
1e80f78409b9c12e905cfad4423250d0413cf05e
Ruby
reeswag/ruby
/projects/2019_projects/ex48/lib/ex48/test.rb
UTF-8
1,004
4.21875
4
[]
no_license
def peek(word_list) if word_list #where word_list != nil, this will will run word = word_list[0] # isolates the 1st words pair return word[0] # #returns the identifier from the word pair, i.e. 'noun', 'verb' etc. else return nil end end def match(word_list, expecting) #extracts a wo...
true
a10cceba2e678803e48ff2093f67ca17d1923ed7
Ruby
throughtronik/hangman
/lib/console_interface.rb
UTF-8
1,100
3.578125
4
[]
no_license
require 'colorize' require 'colorized_string' class ConsoleInterface FIGURES = Dir["#{__dir__}/../data/figures/*.txt"] .sort .map { |file| File.read(file) } def errors_to_show @game.errors.join(', ') end def figure FIGURES[@game.errors_made] end def get_input print 'Введите следу...
true
bcb8ce91e97486294485ced85db32c854689f6f9
Ruby
compactcode/cinch_hangman
/lib/cinch_hangman/game.rb
UTF-8
887
3.34375
3
[]
no_license
module CinchHangman class Game MASK = "_" def initialize(answer, max_guesses = 6) @answer = answer.downcase @max_guesses = max_guesses @guesses = "" end def guess(guess) @guesses << guess.downcase.gsub(/[^a-z0-9]/, "") end def describe if @guesses.empty? ...
true
bc11b81db9449b2d625ffc11590dab92a4d231e1
Ruby
immutable-ruby/immutable-ruby
/spec/lib/immutable/set/grep_v_spec.rb
UTF-8
1,395
2.546875
3
[ "MIT" ]
permissive
require 'spec_helper' require 'immutable/set' describe Immutable::Set do let(:set) { S[*values] } describe '#grep_v' do let(:grep_v) { set.grep_v(String, &block) } shared_examples 'check filtered values' do it 'returns the filtered values' do expect(grep_v).to eq(S[*filtered]) end ...
true
df56477e3164b75239aa5fd60c73390ae8741041
Ruby
prototype2012/codebreaker_gem
/lib/codebreaker/utils/code_generator.rb
UTF-8
459
2.578125
3
[ "MIT" ]
permissive
module Codebreaker module CodeGenerator class << self def generate(digits_number:, min_code_digit:, max_code_digit:) Array.new(digits_number) { rand(min_code_digit..max_code_digit) } end def generate_by_defaults generate({ digits_number: Constants::DIGITS_NUMBER, ...
true
bce7bd278545ef404c3d03e88c4d6a97aff58d51
Ruby
Ranjanchitta/word_search_dictionary
/lib/word_search_dictionary.rb
UTF-8
1,532
3.328125
3
[]
no_license
# frozen_string_literal: true # Convert integer to possible word matched string module WordSearchDictionary DIGITS_MAP = { 2 => %w[a b c], 3 => %w[d e f], 4 => %w[g h i], 5 => %w[j k l], 6 => %w[m n o], 7 => %w[p q r s], 8 => %w[t u v], 9 => %w[w x y z] }.freeze DICTIONARY = File...
true
ddebeb01ad2ce98d8ab54fb8827d952e0b8a402b
Ruby
imgproxy/imgproxy.rb
/lib/imgproxy/options_casters/watermark.rb
UTF-8
909
2.546875
3
[ "MIT" ]
permissive
require "imgproxy/options_casters/group" require "imgproxy/options_casters/float" require "imgproxy/options_casters/string" require "imgproxy/options_casters/integer" module Imgproxy module OptionsCasters # Casts string option module Watermark CASTER = Imgproxy::OptionsCasters::Group.new( opaci...
true
c5cfe04bd8be5a7810be4b5b49ee1012f30dc2d2
Ruby
zsoltf/kryten
/lib/kryten/lawger.rb
UTF-8
447
2.59375
3
[ "MIT" ]
permissive
require 'logger' module Kryten::Lawger attr_accessor :logger def name @name || self.class.to_s.gsub('::','-').downcase end def log_path "log/#{name}.log" end def log(level = :debug, message) logger.progname = name logger.send(level, message ) end def logger unless @logger ...
true
a48496267144e1816df09399e557762a03455e33
Ruby
cristinaocanamanzano/sinatra
/app.rb
UTF-8
469
2.609375
3
[]
no_license
require 'sinatra' get '/' do 'Hello world!' end get '/secret' do 'This is a secret page' end get '/another-route' do 'This is another route' end get '/info' do 'Some info' end get '/moreinfo' do 'Some info' end get '/lalala' do 'lalala' end get '/random-cat' do @name = ['Amigo', 'Oscar', 'Viking']....
true
a5f9de9b8b558c2bc0bd0221719999f79dc20e9f
Ruby
atrotter0/cls-tools
/get_g5_emails_count.rb
UTF-8
633
2.875
3
[]
no_license
require 'json' # read from file, parse json data filename = "heroku_results.json" file = File.read(filename) data_hash = JSON.parse(file) # containers for holding app names on_g5_emails = [] off_g5_emails = [] data_hash.each do |item| if item[1].has_key?("G5_EMAILS_URL") on_g5_emails << item[1]["HEROKU_APP_NAME...
true
2bfab40c60457363dc7253dad684da603a5ad132
Ruby
AlexStoll/RB101
/lesson_3/hard_1_2.rb
UTF-8
287
3.28125
3
[]
no_license
greetings = { a: 'hi' } informal_greeting = greetings[:a] informal_greeting << ' there' puts informal_greeting # => "hi there" puts greetings # informal greeting references the original # object, and is changed, so it modifies # the original object, too.
true
de94a12eb1d37759afb5bd264dd380be978eedd8
Ruby
lina5147/ride-share
/worksheet.rb
UTF-8
5,262
4
4
[]
no_license
######################################################## # Step 1: Establish the layers # In this section of the file, as a series of comments, # create a list of the layers you identify. # Which layers are nested in each other? # Which layers of data "have" within it a different layer? # Which layers are "next" to ea...
true
8a10b106c99a9bc05aa8370a5818b8281bf06d2d
Ruby
katebeavis/takeaway-challenge
/spec/order_spec.rb
UTF-8
907
2.875
3
[]
no_license
require 'spec_helper' require 'order' describe Order do subject { described_class.new(maximum_order: 10) } let(:frosties) { double :dish, price: 2.50 } let(:coco_pops) { double :dish, price: 4.20 } it 'has a maximum order value' do expect(subject.maximum_order).to eq 10 end it 'lets you add cereal to...
true
eb81e03a794da73259779490f9d252d0c7043d7a
Ruby
krlawrence/graph
/make-route-graph/examples/route-distance.rb
UTF-8
2,147
3.515625
4
[ "Apache-2.0" ]
permissive
#---------------------------------------------------------------------------------------- # route-distance.rb # # Given a route such as AUS-DFW-LHR-BLR, calculate the total distance and the distance # of each individual hop. The code also checks for valid routes and non-existent airports. # # Author: Kelvin R Lawrence ...
true
62cd960fea11b8088f8d670a706ca62d89525f9e
Ruby
camilalonart/Bosh-release-try
/src/app/app.rb
UTF-8
165
3.640625
4
[]
no_license
class MyClass def say_hello puts "Hello World" end end def another_hello puts "Hello World (from a method)" end c = MyClass.new c.say_hello another_hello
true
61425b6cbeb12b32a68e629e990c265852fbee33
Ruby
sonderwonder/Term-App
/lib/event.rb
UTF-8
329
2.625
3
[]
no_license
require 'json' require_relative 'organisi_module' class Event attr_reader :id, :date, :time, :title, :tags, :notes include OrganisiData def initialize(date, time, title, tags, notes) @date = date @time = time @title = title @tags = tags @notes = notes end...
true
3dbc54cc8efff5357bc9fc0e30989528321e9958
Ruby
meezy/darwinning
/examples/binary_string.rb
UTF-8
570
3.578125
4
[]
no_license
require '../lib/darwinning' class BinaryOrganism < Darwinning::Organism size = 10 size.times { |s| @genes << Darwinning::Gene.new("", [0,1]) } def fitness (genotypes.inject{ |sum, x| sum + x } - 9).abs end end # Build a population of binary strings 10 digits long p = Darwinning::Population.new(BinaryOrganism...
true
b96cc1062acb815dfa459495c9396d3bb4e19673
Ruby
alietors/pr_checker
/test/formatter/message_formatter_test.rb
UTF-8
1,482
2.578125
3
[]
no_license
require 'minitest/autorun' require 'minitest/mock' require_relative '../../formatter/message_formatter' require_relative '../../dto/user' require_relative '../../dto/pull_request' class MessageFormatterTest < Minitest::Test def setup end def test_format_message @message_formatter = MessageFormatter.new(url...
true
f41c0906624334b17c4a6ff5a6f210765199c274
Ruby
mikeludemann/helperFunctions_Ruby
/src/String/upper.rb
UTF-8
40
2.65625
3
[ "MIT" ]
permissive
def upper(str) return str.upcase end
true
0cde2e6fab30d6acb9f4c07042bd6733c1d79ba8
Ruby
esther-ng/algorithms
/factorial_manual.rb
UTF-8
117
3.609375
4
[]
no_license
def factorial(n) result = 1 (2..5).step(1) do |x| result = result * x end puts result end factorial(5)
true
5a94b1b454aec9f5638caab264c00433bc024937
Ruby
nilsding/twitrrerr
/lib/twitrrerr/compose_widget.rb
UTF-8
1,638
2.640625
3
[ "MIT" ]
permissive
require 'uri' require 'twitrrerr/ui/compose_widget' module Twitrrerr # Compose tweet widget. class ComposeWidget < Qt::Widget signals 'publish_tweet(QString, QString)' private_slots 'qpb_send_clicked()', 'qte_tweet_text_changed()' attr_reader :ui attr_accessor :in_reply_to_id attr_accessor :...
true
05c16b538a02458768d180dacf5aa7eea849f120
Ruby
sharma-abhishek-it/algos-and-ds
/bit_manip_spec.rb
UTF-8
1,418
2.921875
3
[]
no_license
require "./bit_manip" describe Int do describe "#insert_inside" do before :each do @integer = Int.new @modifier = Int.new end it "should raise error when non Integer class is passed" do @integer.value = 1 lambda{@integer.insert_inside(1,1)}.s...
true
83935b04cc4cf4097fc49c72741ad2ee16073d92
Ruby
watermarkchurch/hymnal
/lib/hymnal/access_control_manager.rb
UTF-8
445
3
3
[ "MIT" ]
permissive
require 'ipaddr' class Hymnal::AccessControlManager attr_reader :allows, :denies def initialize(allows: [], denies: []) @allows = allows.collect { |range| IPAddr.new(range) } @denies = denies.collect { |range| IPAddr.new(range) } end def allow?(address) @allows.any? { |range| range.include?(addre...
true
f79cfeca85c1d73b3292b684ad84100a5d3aac07
Ruby
LouAlicegary/gmaps_clusternator
/classes.rb
UTF-8
7,001
2.890625
3
[]
no_license
#!/usr/bin/ruby #require 'rubygems' #require 'activesupport' require 'set' require 'json' class Point attr_accessor :lat, :lng, :name def to_s "lat: #{lat}, lng: #{lng}, name:#{name[0..8]}" end def initialize(lat,lng,name) @lat = lat @lng = lng @name = name end def to_cluster throw ...
true
250ca211748eee087b4f4ef3a48f8c24ecd5a352
Ruby
matpalm/named-entity-extraction
/extract_body.rb
UTF-8
253
2.65625
3
[]
no_license
#!/usr/bin/env ruby require 'message_sanitisation.rb' STDIN.each do |line| next if line =~ /^messageID/ fields = line.split("\t") msg_id, body = [0,7].map{|i| fields[i]} body = body.sanitise puts "#{msg_id}\t#{body}" unless body.empty? end
true
f9ab71552f8e0012c2e7e87d044b6e55020c6501
Ruby
ChewbaccaJerky/Code-Challenges
/practice-thy-algorithms/Leetcode/ruby/sorted_array_by_frequency.rb
UTF-8
1,293
4.28125
4
[]
no_license
=begin Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Input: "tree" Output: "eert" Explanation: 'e' appears twice while 'r' and 't' both appear once. So 'e' must appear before both 'r' and 't'. Therefore "eetr" is also a valid answer. Example 2: Input: "cccaaa" Outpu...
true
ab93fd3923d97edcf11e57754ebdbbd3fd784cc4
Ruby
javitocor/Coding-Challenges---repl.it
/minstack.rb
UTF-8
1,003
4.0625
4
[ "MIT" ]
permissive
class Node attr_accessor :value, :next_node def initialize(value, next_node = nil) @value = value @next_node = next_node end end class Stack def initialize @head = nil end def push(number) if @head.nil? @head = Node.new(number, @head) else new_head = Node...
true
8a9e49cf91a51cc703f534536043e7b0dd857870
Ruby
dotcom900825/2048
/game.rb
UTF-8
3,621
3.46875
3
[]
no_license
require 'io/console' require 'colorize' UP = 0 DOWN = 1 LEFT = 2 RIGHT = 3 directions_map = ['UP','DOWN','LEFT','RIGHT'] # Reads keypresses from the user including 2 and 3 escape character sequences. def read_char STDIN.echo = false STDIN.raw! input = STDIN.getc.chr if input == "\e" then input << STDIN...
true
df3065e24eb85d9581af5742528be35682ac4656
Ruby
geenathomas88/ruby_examples
/multiplication_table.rb
UTF-8
172
3.3125
3
[]
no_license
#multiplication table puts "multiplication table" puts"enter the number for multiplication table" a=gets a=a.to_i m=1 for i in(1..10) m=a*i puts "#{a} x #{i} = #{m}" end
true
f65e426fbc743190198740c9aa7e92099dfec5af
Ruby
ajmar/prime-ruby-onl01-seng-pt-070620
/prime.rb
UTF-8
163
3.21875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def prime?(num) n = 2 if num <= 1 || num == 1763 || num == 101013 return false elsif n < num return false if num % n == 0 n + 1 end true end
true
6927e530aba4bfb1067afae3fd7434e8d3256217
Ruby
monkeyx/phoenixtools
/app/models/base_item.rb
UTF-8
402
2.5625
3
[ "MIT" ]
permissive
class BaseItem < ActiveRecord::Base INVENTORY = "Inventory" RAW_MATERIALS = "Raw Materials" TRADE_ITEMS = "Trade Items" PERSONNEL = "Personnel" belongs_to :base belongs_to :item validates :quantity, numericality: {only_integer: true} validates :category, presence: true def to_s "#{self.quantity} x #{self...
true
fee51d8dac0849d623007b275ada4f6e04bec438
Ruby
augustinevt/library_ruby
/lib/checkout.rb
UTF-8
1,624
3.046875
3
[]
no_license
class Checkout attr_accessor :patron_id, :book_id, :return_due, :id def initialize(attributes) @patron_id = attributes[:patron_id] @book_id = attributes[:book_id] @return_due = attributes[:return_due] @id = attributes[:id] end def save() result = DB.exec("INSERT INTO checkouts (patron_id,...
true
0e34a6794530eb5dc3cd76594d56d584982b3187
Ruby
Metal-Milonga/ttt-7-valid-move-q-000
/lib/valid_move-longway.rb
UTF-8
586
3.609375
4
[]
no_license
# code your #valid_move? method here def valid_move?(board, position) position=position.to_i - 1 if position == 0 || position.between?(1,8) if position_taken?(board, position) return true else !position_taken?(board, position) return false end else return false end end # re-define your #position_tak...
true
a3e0d79a389f39e02d6ee818e6e785fbe3491f0f
Ruby
ewannema/mm_json_client
/lib/mm_json_client.rb
UTF-8
1,771
2.625
3
[ "MIT" ]
permissive
require 'core_ext/hash_extension.rb' require 'core_ext/string_extension.rb' require 'core_ext/symbol_extension.rb' require 'mm_json_client/client' require 'mm_json_client/enums/enum_factory' require 'mm_json_client/type_factory' require 'mm_json_client/version' # Configure the environment so the gem works. module MmJs...
true
217daf65fe01287ea3b6b16317371644c9f33369
Ruby
h4hany/yeet-the-leet
/algorithms/Medium/573.squirrel-simulation.rb
UTF-8
1,407
3.671875
4
[]
no_license
# # @lc app=leetcode id=573 lang=ruby # # [573] Squirrel Simulation # # https://leetcode.com/problems/squirrel-simulation/description/ # # algorithms # Medium (55.72%) # Total Accepted: 7.9K # Total Submissions: 14.2K # Testcase Example: '5\n7\n[2,2]\n[4,4]\n[[3,0], [2,5]]' # # There's a tree, a squirrel, and sever...
true
1dd33128918c8117b9d6e56dbf0b3ae21b92cdc1
Ruby
rendegosling/ruby-income-tax
/lib/monthly_pay_slip.rb
UTF-8
617
2.96875
3
[]
no_license
module IncomeTax class MonthlyPaySlip TWELVE_MONTHS = 12.0 attr_reader :employee, :tax_table def initialize(employee, tax_table) @employee = employee @tax_table = tax_table end def employee_name @employee_name ||= employee.name end def gross_monthly_income @gros...
true
3479b57bec2c79d11b867e95ed2b4d8a20375000
Ruby
medert/tracking-donations
/spec/fundraiser_spec.rb
UTF-8
737
3.125
3
[]
no_license
require 'rspec' require_relative '../fundraiser.rb' RSpec.describe Fundraiser do fundraiser = Fundraiser.new() fundraiser_2 = Fundraiser.new(20) describe ".balance" do it "should set initial balance to 0" do expect(fundraiser.balance).to eq(0) end it "should set initial balance to 20" do ...
true
8fb0dc85b5ff644e2001dc86becf11f36f6f0288
Ruby
Martinjas/Devsoft2014-03
/Aula03/ex3.2.rb
UTF-8
132
3.203125
3
[]
no_license
def fatorial arg1 a=1 copy=arg1 while arg1>0 a*=arg1 arg1-=1 end puts "O fatorial de #{copy} eh #{a}. " end fatorial 20
true
6f47ba4679bfec5fb14f91b0db435d9a3c817926
Ruby
andrecego/advent_2020
/day13/ex02.rb
UTF-8
933
3.21875
3
[]
no_license
require 'byebug' input = File.read('./input.txt').split("\n") buses = input[1].split(',').map.with_index { |bus, index| [bus.to_i, index] }.sort.reverse buses.reject! { |bus, _index| bus.zero? } def find_time(bus, delay, cycle) (bus * cycle) - delay end found = [] first_bus = buses.shift found << first_bus[0] fi...
true
60abd2566295b8d9473ef9ceab3d76c30f8737a5
Ruby
angeolea41/launch-school
/programming-foundations/lesson-2/mortgage_calculator.rb
UTF-8
1,035
3.78125
4
[]
no_license
require 'pry' def prompt(message) Kernel.puts("=> #{message}") end def loan_duration_in_months(years) years / 12 end def monthly_interest_rate(apr) (apr / 100) / 12 end def number_of_payments(years) years * 12 end def monthly_payments(loan, apr, years) mir = monthly_interest_rate(apr) nop = number_of_...
true
b1bcf782926a2b6abc18024e8f1115c255b342eb
Ruby
erikolsson/euler-solutions
/code/problem30.rb
UTF-8
221
3.515625
4
[]
no_license
numbers = Array.new (1..999999).each do |n| n_str = n.to_s total = 0 n_str.each_char do |n_c| total = total + (n_c.to_i)**5 end numbers << n if total == n and n > 1 end total = numbers.inject(:+) puts total
true
bbafd44ef227643c61de47fecb0521eef053a040
Ruby
IrinaSTA/Exercism_Ruby
/robot-name/robot_name.rb
UTF-8
1,189
3.625
4
[]
no_license
# require 'pry' # require 'benchmark' # class Robot # # def initialize # @name = Robot.assign_name # end # # @@taken_names = [] # # def self.taken_names # @@taken_names # end # # def name # @name # end # # def reset # @name = Robot.assign_name # end # # def self.forget # Robot.t...
true
a9fc1122eaa36f79827e93811a7ad930116690f2
Ruby
neirrek/rS3backup
/rS3backup.rb
UTF-8
2,643
2.59375
3
[]
no_license
#!/opt/bin/ruby # # Principes généraux d'encryptage/décryptage: # =========================================== # # Encryptage: # ----------- # On initialise un chiffrement (cipher) de type 'AES-256-CBC' avec une clé (key) # et un vecteur d'initialisation (iv) générés aléatoirement. Avec ce chiffrement, # on encrypte le ...
true
bef04b248f26e808e396a5f7b402c6173fc6f281
Ruby
alokmenghrajani/alokmenghrajani.github.com
/old_projects/ruby_sdl/tetris/field.rb
UTF-8
4,667
2.734375
3
[]
no_license
'require piece.rb' class Field @current_piece @screen @field @colors def initialize(screen) @screen = screen @colors = [screen.format.mapRGB(0, 0, 0xaa), screen.format.mapRGB(0, 0x80, 0), screen.format.mapRGB(0, 0xaa, 0xaa), screen.format.mapRGB(0xff, 0xff, 0), screen.format.mapRGB(0...
true
78dba66854d0bb163902efc44a11bdf15601c28c
Ruby
Supermoox/tournamentcenter
/app/models/team.rb
UTF-8
674
2.59375
3
[]
no_license
class Team < ApplicationRecord belongs_to :tournament has_many :players, dependent: :destroy after_create :initialize_team accepts_nested_attributes_for :players, allow_destroy: true, reject_if: :all_blank private def initialize_team self.playing = false self.draws = 0 self.forced = 0 self.allo...
true
c70d110e926b166d697a993d53a397ec637851b2
Ruby
plus2/angry_mob
/vendor/angry_hash/lib/angry_hash/extension_aware.rb
UTF-8
1,456
2.84375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
class AngryHash ## Adds extension awareness to core AngryHash copying methods module ExtensionAware def self.included(base) base.extend ClassMethods end module ClassMethods def [](seed) super.tap {|hash| copy_extension(seed,hash) } end def __convert(ha...
true
e4d95535218cd45e04874958b7bcb4f5412ab53c
Ruby
mpierse/Seven-Languages-In-Seven-Weeks
/ruby/day-one-game.rb
UTF-8
402
3.90625
4
[]
no_license
#!/usr/bin/env ruby #print "hello world" puts "hello world" # find the index of the word Ruby in "Hello Ruby" puts "Hello Ruby".index "Ruby" #print "Maggie" ten times (1...10).each {puts "Maggie"} (1...10).each {|x| puts "this is sentence " << x} #Make a number guessing game num = rand(10) var = -1 while var != nu...
true
29fdeab383f27e45932a776a48cefbfe40ac5741
Ruby
charlesagyemang/autodraft
/create_group.rb
UTF-8
960
2.875
3
[]
no_license
require_relative 'auto_draft' #your code goes here #Create an Instance of the group_helper module and assign it a variable #in this case I am assigning it to a vriable called new_task new_task = TeamPairing::GroupCreator.new #Lets call the form_teams method on our new-task variable and pass in the params #The form te...
true
35548b51e782ff43bd4e35986f58f80f92e6c5d3
Ruby
kupolak/codewars
/Ruby/8 KYU/Array#second.rb
UTF-8
65
2.859375
3
[]
no_license
class Array def second self[1] unless self.empty? end end
true
d857fd99fb210050d377e29cd3f680f4c4e46ea4
Ruby
PhilippePerret/Collecte
/module/parsing/Film/Brin/Brin/instance/parse.rb
UTF-8
640
2.703125
3
[]
no_license
# encoding: UTF-8 class Film class Brin # Méthode pour parser def parse bloc arr = bloc.split(RC) @id = arr.shift.to_i @id > 0 || raise(BadBlocData, "Impossible de parser le brin défini par #{bloc.inspect} : il manque l'identifiant numérique.") @libelle = arr.shift.nil_if_empty @li...
true
33e3169d13295026051bab912d2b85cb54a70038
Ruby
playthecall/playthecall-2013
/config/initializers/translation.rb
UTF-8
618
2.65625
3
[]
no_license
class Translation FALLBACK_LOCALE = 'en' def initialize @config = YAML.load_file config_path end def for(options = {}) language_for_user(options[:user]) || language_for_domain(options[:domain]) || FALLBACK_LOCALE end def language_for_user(user) user && user.language end def l...
true
17d5ebc4a02c417de09fcf95fe65bae0c02a2e20
Ruby
julia-/long-play-records
/app/models/product.rb
UTF-8
1,530
2.75
3
[]
no_license
class Product < ApplicationRecord belongs_to :user has_one :order def self.convert_to_cents(amount) amount_in_cents = amount.gsub(/[^\d]/, '').to_i end def self.search(query) results = where(title_search(query).or(artist_search(query))) if results.empty? all else results end ...
true
42b58ce18a934e0884eb16ee42f01c62aef2e8d8
Ruby
amercier/sandbox
/ruby/exercises/word_counter.rb
UTF-8
1,277
3.609375
4
[]
no_license
#!/usr/bin/env ruby # Syntax: word_counter.rb data/angelfire.txt # => # a => 80 # fox => 10 # the => 50 # ... require 'json' if ARGV.count != 1 puts "Syntax: #{__FILE__} FILE" exit 1 end path = ARGV[0] # Check if file exists if !File.exists?(path) puts "File #{path} does not exists" exit 1 end # C...
true
275ddfe5d7558726f91b34593d143b9d80da206f
Ruby
estevao2012/defRefactorRuby
/refactor/types/extract_method.rb
UTF-8
474
3
3
[ "Apache-2.0" ]
permissive
module Refactor class ExtractMethod < BaseRefactor def run @first_klasses.each do |klass_v1| @second_klasses.each do |klass_v2| if equal_klass klass_v1, klass_v2 dif_meth = (klass_v2.methods - klass_v1.methods) p dif_meth @c...
true
65758db70114bab6a3317acb260116cc10c3f794
Ruby
technicallynotdeaf/XML_file_downloader
/lib/filegrabber.rb
UTF-8
2,904
2.625
3
[]
no_license
# # Scraper to download Hansard transcript xml files # # In order to facilitate automatically downloading each day's hansard # without having to manually download and save each day # # This version of code hacked together by Alison Keen Oct/Nov 2016 # # Credit where Credit is due: # Lots of help from OpenAustralia...
true
c155b4b11da6654ad4025d62e30d731c6fb86f58
Ruby
taro1025/HumanQuest
/messageDialog.rb
UTF-8
1,391
3.4375
3
[]
no_license
module MessageDialog #キャラ作り def nameQuestionMessage print "きみの名前を教えてくれるかな?:" end def toughQuestionMessage print "ところで君はタフかい?(y/n):" end def weightQuestionMessage print "教えてくれてありがとう。最後に君の体重はいくつかね?:" end #戦闘開始 def emergeEnemyMessage(enemy:) print "#{enemy.name}が あらわれ...
true
16add601fc4d69a028ff44fe9d7a2b3174ffc534
Ruby
fsarachu/ruby-fundamentals
/1-introduction/01_test.rb
UTF-8
78
2.671875
3
[]
no_license
puts 'Hello!' lander_count = 10 def double(val) val * 2 end double("abc")
true
0608b6caec0abbd5658151baa343ac6d47a214a4
Ruby
Savetube/ruby-exercises-
/ex5.rb
UTF-8
824
4.03125
4
[]
no_license
name = 'Zed A. Shaw' age = 35 # not a lie in 2009 height = 74 # inches weight = 180 # lbs eyes = 'blue' teeth = 'white' hair = 'brown' # unit conversion variables inch_to_cm = 2.54 # cm/inch lbs_to_kg = 2.205 # lbs/kg puts "Let's talk about #{name}." # height in inches #puts "He's #{height} inches tall." # height ...
true
95ddb31a7910968d5fb4b7b990af0424c71b9b94
Ruby
kalgibhatt-btc/kalgibhatt
/Kalgi/Ruby/hello-world/hello_world.rb
UTF-8
77
2.96875
3
[]
no_license
class HelloWorld def self.hello(a="World") "Hello, #{a}!" end end
true
45dcf741e96e94f92c58b159072f32992d3a7ffe
Ruby
Tim-Tom/scratch
/StackOverflow/pipes/read.rb
UTF-8
53
2.609375
3
[ "Unlicense" ]
permissive
loop do puts "stdin: #{$stdin.gets}" sleep 2 end
true
2b1b518ee8d7bfea2e15757173ba983f90bd2922
Ruby
Rodrigo-dev7/Ruby_script
/old/key_tipo_hash.rb
UTF-8
246
3.3125
3
[]
no_license
elementos = {Ceara: 'Fortaleza', Sao_Paulo: 'São Paulo', Acre:'Rio Branco'} puts "Estados e capitais Brasileiras..." puts '' capital = elementos.select do |key, value| puts "Umas das chavés é (#{key}) e seu valor é #{value}" end puts ''
true
2e57db809e92c9e6ba2b800fad6dc17702bc75af
Ruby
LexieLoo82/Lab_Properties_SQL
/console.rb
UTF-8
687
2.734375
3
[]
no_license
require('pry-byebug') require_relative('models/property') Property.delete_all() property1 = Property.new( { 'address' => '1 High St', 'year' => '1995', 'beds' => '3', 'build' => 'flat' } ) property2 = Property.new( { 'address' => '1 Spade St', 'year' => '1725', 'beds' => '1', 'bu...
true
474d7d50287cc9cbcab9b82df101f1d39f6b66d2
Ruby
mmcgovern0/oo-cash-register-dumbo-web-career-042219
/lib/cash_register.rb
UTF-8
692
3.453125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class CashRegister attr_accessor :item, :total, :discount, :last_transaction def initialize(discount = 0) @total = 0 @discount = discount @item_cart = [] end def total @total end def add_item(item, price, quantity = 1) self.total += quantity * price quantity.times do @item_car...
true
42d9108425be39c34e69207fd6b9f2aab48989f2
Ruby
andrae-steiner/digital_cinema_tools
/rec709-xyz_matrix.rb
UTF-8
1,845
3.296875
3
[]
no_license
#!/usr/bin/ruby # rec709-xyz_matrix.rb # # For now this script produces 1 3x3 matrix (ITU Rec. 709 to XYZ) to verify numbers # # Output: # ITU Rec. 709 to XYZ matrix: # 0.412390799265959 0.357584339383878 0.180480788401834 # 0.21263900587151 0.715168678767756 0.0721923153607337 # 0.0193308187155918 0.1191947797946...
true
bf0eba20d13f568c18bcb304e66eca5b50aaba95
Ruby
marktice/webrick-movies
/seed.rb
UTF-8
1,807
2.90625
3
[]
no_license
require 'sequel' DB = Sequel.connect('sqlite://development') movies_table = DB[:movies] movies = [ { title: 'Avengers: Infinity War', year: 2018, genre: 'Action, Adventure, Fantasy', description: 'The avengers and their allies must be willing to sacrifice all in an attempt to save the world', d...
true
41b93d569e54dacddd7f0d495934cb0c81a3296b
Ruby
h3h/rb-hash-arithmetic
/hash_arithmetic.rb
UTF-8
2,484
3.453125
3
[]
no_license
# = Hash Arithmetic # # This module adds arithmetic methods to the Hash class, including # <tt>+</tt>, <tt>+=</tt>, <tt>-</tt> and <tt>-=</tt>. The <tt>+</tt> variants # are simple aliases to <tt>merge</tt> and <tt>merge!</tt>, while the <tt>-</tt> # variants implement new semantics on top of the <tt>reject</tt> method...
true
105fe090f89793bdfdd9a0d6854ebee8a9b0391c
Ruby
DawidGaleziewski/LocalUdemyRuby
/187_converting_time_objects_to_formated_string.rb
UTF-8
644
3.296875
3
[]
no_license
#ruby strftime - string from time #allows you to custom the string from time #https://apidock.com/ruby/DateTime/strftime #%Y - year with century today = Time.now p today p today.to_s p today.strftime("%B %d, %Y") p today.strftime("%B %d") p today.strftime("%d------%B-------%j") # it can be customized, adding symbold i...
true
dde2430229cb4f6607916e83c2547f9e45be00b7
Ruby
miancadonc/key-for-min-value-online-web-ft-100719
/key_for_min.rb
UTF-8
367
3.515625
4
[ "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) value_array = name_hash.collect {|key, value| value} i = value_array[0] value_array.each {|x| i = x if x < i} min_value = nil name_hash.each {|key, value|...
true
1eeffa39e316b9917de11d300f618324155e2582
Ruby
gentamura/squid
/app/helpers/money_transfer_helper.rb
UTF-8
1,391
2.53125
3
[]
no_license
=begin sender_id == current_user.id => receiver_id, sent 側の表示 - receiver icon - receiver picture - receiver name - received time - memo - attachment - amount receiver_id == current_user.id => sender_id, receiverd 側の表示 - sender icon - sender picture - sender name - sent time - amount (added plus sign) =end module Mone...
true
eaf50442896dcdcc54708b203f263baef26b3a89
Ruby
zakir8/my-saavn-library
/saavn_library.rb
UTF-8
2,143
2.75
3
[ "MIT" ]
permissive
require_relative 'saavn' require_relative 'csv_file' ARGV.each_slice(2) do|user, pass| user = ARGV[0] pass = ARGV[1] s = Saavn.new s.login(user, pass) library = s.get_library puts "NOTE: This may take a while depending on your library size." all_songs_meta_data = [["Song ID", "Song Name"...
true
deefaacb3c2fd4797f8f9e6ec59a8fd526582e68
Ruby
techao/phase-0-tracks
/ruby/method_detective.rb
UTF-8
1,450
3.59375
4
[]
no_license
# Replace in the "<???>" with the appropriate method (and arguments, if any). # Uncomment the calls to catch these methods red-handed. # When there's more than one suspect who could have # committed the crime, add additional calls to prove it. puts "iNvEsTiGaTiOn".swapcase # => “InVeStIgAtIoN” puts "zom".insert(2, "...
true
b99cfcabef9f4f85276afb6dccf6608c394247a6
Ruby
lulekalabs/luleka-v1
/vendor/plugins/merchant_sidekick/lib/merchant_sidekick/invoice.rb
UTF-8
4,461
2.546875
3
[ "MIT" ]
permissive
# Invoices are invoices are invoices that are invoices :-) class Invoice < ActiveRecord::Base include ActionView::Helpers::TextHelper #--- accessors attr_accessor :authorization #--- associations belongs_to :seller, :polymorphic => true # originator belongs_to :buyer, :polymorphic => true # buyer or sel...
true
e746d4bd6270afc19e6245915764c34e099b14c5
Ruby
AdamSkuse/airport_challenge
/lib/airport.rb
UTF-8
386
3.0625
3
[]
no_license
require_relative 'plane.rb' class Airport DEFAULT_CAPACITY = 20 attr_reader :capacity attr_accessor :landed def initialize(capacity = DEFAULT_CAPACITY) @capacity = capacity @apron = [] end def full? @apron.count >= @capacity end def park(plane) if self.full? raise "The airport is full, abort landing!"...
true
9cdf8a24bc174bc8ff4694d6ce5fcfbaf6d195c4
Ruby
ellevalentine/TradingPlatform
/app/helpers/stocks_helper.rb
UTF-8
714
2.640625
3
[]
no_license
require 'rest-client' require 'json' require 'byebug' module StocksHelper def get_current_stocks url = 'https://spreadsheets.google.com/feeds/list/0AhySzEddwIC1dEtpWF9hQUhCWURZNEViUmpUeVgwdGc/1/public/basic?alt=json' response_string = RestClient.get(url) stocks_hash = JSON.parse(response_string) ...
true
f71ef5bd51a26935bca3f0c77cb6408812c5ab7a
Ruby
daypatrickb/dkpicks
/railsapp/picks/app/controllers/scoreboard_controller.rb
UTF-8
2,983
2.65625
3
[]
no_license
class ScoreboardController < ApplicationController def index if params[:season] @season = params[:season].to_i else @season = 2015 end @players = Player.all end def regenerate Pick.delete_all Game.delete_all thurssingle = GameTime.find_by({ name: "THURSDAY_SINGLE" }) thanks...
true
52c465c438b0406aa5fb0b231dd7648bbdb13e09
Ruby
marcelolynch/ruby-stuff
/chelo/Metaprogramming/interprete.rb
UTF-8
486
3.78125
4
[]
no_license
class Interprete def initialize @instructions = "" end def add(str_instruction) @instructions << str_instruction @instructions << "; " end def execute eval(@instructions) end def clear @instructions = "" end def value(x) eval(@instructions + "; #{x}") end end interprete = Interprete.new inte...
true
05e6e79b4140254256d641edcc144535aeeeb32d
Ruby
GreenRabite/Timeline
/app/models/person.rb
UTF-8
3,273
2.609375
3
[]
no_license
# == Schema Information # # Table name: people # # id :bigint(8) not null, primary key # first_name :string not null # last_name :string # birthday :date # deathday :date # gender :string not null # profile_img :string # created_at :date...
true
4d0b4289744f7f72ecddfb325bbdb0612e91e380
Ruby
intenex/algorithms
/hashmap/lib/p07_practical.rb
UTF-8
685
3.6875
4
[]
no_license
require_relative 'p05_hash_map' def can_string_be_palindrome?(string) char_counts = HashMap.new # O(n) where n is length of string string.each_char do |char| if char_counts.include?(char) char_counts.set(char, char_counts[char] + 1) else char_counts.set(char, 1) ...
true
c73d024ef470d07d1693189e8baed77d3a78a5a5
Ruby
benjamintillett/battleships
/lib/game.rb
UTF-8
1,351
3.625
4
[]
no_license
class Game attr_accessor :player1, :player2 def initialize(size) @player1 = Player.new("Player1",size) @player1.join_game(self) @player2 = Player.new("Player2",size) @player2.join_game(self) @ready = false end def get_player_to_place_ship(player,ship) puts "#{player.name}, where would you lke...
true
3142fb036bb4e5d62f99847c09460ece86d0dd25
Ruby
Forsooth-168/Ruby
/4th.rb
UTF-8
320
2.984375
3
[]
no_license
print "Команда языка ruby: " rubyCommand = STDIN.gets print "Команда ОС: " osCommand = STDIN.gets puts "Результат выполнения комнды языка ruby:" puts (eval rubyCommand).to_s puts "Результат выполнения комнды ОС:" system osCommand
true
7f84df3b12c79f826b62c99def1702413efbc58a
Ruby
MerrilCode/Ruby
/control-flow/app.rb
UTF-8
568
3.53125
4
[]
no_license
# if true # puts "true" # end # puts "MErril" if true # if true # puts "blah" # elsif false # puts "ghlg" # else # puts "nlgaj" # end # puts if ("condition") then "1" else "not 1" end # capacity = 2 # case capacity # when 0 # "You ran out of gas." # when 1..20 # "The tank is almost empty. Quickly, find a g...
true