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
c33711569f7ba00b496f0a37493ea4b9a7872e58
Ruby
sleepingkingstudios-archive/monster-catcher
/tasks/interactive.rake
UTF-8
691
2.796875
3
[]
no_license
# tasks/interactive.rake task :interactive => [:environment, :logger, :mongoid] do require 'monster_catcher/controllers/routing_controller' require 'mithril/request' Mithril.logger << "~~~~~\nBegin interactive session...\n\n" puts "Welcome to Monster Catcher!" print "> " request = Mithril::Request...
true
cb976020d5ad3aee36372e7e9502d16ba59a1783
Ruby
dotgee/geocms-v0
/vendor/git/active_admin/lib/active_admin/resource/menu.rb
UTF-8
1,185
2.5625
3
[ "CECILL-B" ]
permissive
module ActiveAdmin class Resource module Menu # Set the menu options. To not add this resource to the menu, just # call #menu(false) def menu(options = {}) options = options == false ? { :display => false } : options @menu_options = options end # The options to use ...
true
9086d3cc6f2be5e918689bae272f87e1ac329ad1
Ruby
DataASG/batches
/473/lectures/inheritance-and-self/restaurant.rb
UTF-8
1,226
3.25
3
[]
no_license
require_relative 'chef' class Restaurant attr_reader :name, :location, :clients # attr_reader :capacity # attr_writer :capacity attr_accessor :capacity # encapsulation # YAGNI => You ain't gonna need it # state ? def initialize(name, location, capacity, cuisine, chef_name) @name = name @location ...
true
59a151e118cca7796747a5a3791fd4274af5ee52
Ruby
mlandauer/spider_public_whip
/compare
UTF-8
3,790
2.765625
3
[]
no_license
#!/usr/bin/env ruby # Run this _after_ running spider. It uses the csv file links.csv from the previous step require 'csv' require 'active_record' require 'sqlite3' def read_paths_from_file urls = [] CSV.foreach("links.csv") do |row| urls << row[2] end urls[1..-1].map do |url| u = URI.parse(url) ...
true
f79ecab8ad33431ad5176a9857ddfa11f5a4bf42
Ruby
bollenberger/fpdf
/examples/example7.rb
UTF-8
374
2.65625
3
[]
no_license
# This example, when run, will generate a PDF file called example7.pdf. # This is based directly on the seventh tutorial example given on the # FPDF website (http://www.fpdf.org). require 'fpdf' pdf=FPDF.new pdf.AddFont('Calligrapher','','calligra.rb') pdf.AddPage() pdf.SetFont('Calligrapher','',35) pdf.Cell(0,10,'En...
true
d6ded60b9184227d73c70629b7129a4dc5a30680
Ruby
geoffrey/offerkarma
/app/models/wizard.rb
UTF-8
633
3.015625
3
[]
no_license
module Wizard attr_writer :current_step def current_step @current_step || wizard_steps.first end def next_step self.current_step = wizard_steps[current_step_index+1] end def previous_step self.current_step = wizard_steps[current_step_index-1] end def current_step_index wizard_steps.i...
true
978c9b4f6a0b20b4894a6c3a35e46b365bcfab46
Ruby
I-Mircheva/fight-club-tues
/app/controllers/sums_controller.rb
UTF-8
232
2.65625
3
[]
no_license
require 'csv' class SumsController < ApplicationController def find_sum sum = 0 file = params[:file] CSV.foreach(file.path) do |row| sum += row[0].to_f end render :html => "%.2f" % sum.ceil end end
true
4c74d0c0bef68627c9d47af475ec011a39ab292b
Ruby
ykymd/Docker-MicroRebootable-App
/router/main.rb
UTF-8
2,106
2.65625
3
[]
no_license
require "sinatra" require 'faraday' $stdout.sync = true count = 0 before do ave = `uptime`.chomp.split(":")[-1].split count += 1 puts "[#{count}]LoadAverage:#{ave[0]}" end get "/" do return "It works!" end def getAddress(prefix) prefix = prefix.to_s.upcase ip_address = ENV["#{prefix}_PORT_4...
true
4f50e47160c374f80953ab299b4f556e26d50c89
Ruby
jedschneider/puzzlenode
/steganography_101/spec/bit_flip_spec.rb
UTF-8
265
2.5625
3
[]
no_license
require 'rspec' require 'lib/bit_flip' include BitFlip describe "flipping bits" do it ":to_zero should flip the last bit to a zero" do to_zero(45).should == 44 end it ":to_one should flip the last bit to a one" do to_one(44).should == 45 end end
true
e297b7883b5fc17b1eef3cae1ea109d92a243d41
Ruby
ivanoats/www2
/vendor/plugins/minimalcart/lib/customer.rb
UTF-8
690
2.546875
3
[ "MIT" ]
permissive
# See LICENSE file in the root for details class Customer < ActiveRecord::Base validates_presence_of :first_name, :last_name, :email, :street_address, :city, :state, :zip_code, :country, :phone validates_length_of :first_name, :in => 2..255 validates_length_of :last_name, :in => 2..255 #validates_length_of...
true
24c40f2de0f00661a743257927c3ce1898272951
Ruby
moto-angie/test-flight
/lib/airplane.rb
UTF-8
1,160
3.328125
3
[]
no_license
class Airplane attr_reader :name, :wing_loading, :hp, :engine_status def initialize(name, wing_loading, horsepower, engine_status = "off", location = "grounded") @name = name @wing_loading = wing_loading @hp = horsepower @engine_status = engine_status @location = location end def start ...
true
e6c8539786898a9e0064b95acd42e94f5a737ce7
Ruby
smoline/codewars
/ruby/8kyu_is_this_my_tail.rb
UTF-8
270
3.8125
4
[]
no_license
# https://www.codewars.com/kata/is-this-my-tail/train/ruby require 'awesome_print' def correct_tail(body, tail) sub = body[-1] sub == tail ? true : false end answer = correct_tail("Fox", "x") ap answer # true answer = correct_tail("Emu", "t") ap answer # false
true
3048ed21b25db56f0e782d101f4c1421db8b4031
Ruby
faustoandrade/LIBRARY
/app/controllers/books_controller.rb
UTF-8
861
2.640625
3
[]
no_license
class BooksController < ApplicationController #creacion de metodo index / array con el nombre de 3 libros def index @books = Book.all end def show @book = Book.find(params[:id]) end def new @book = Book.new end def create @book = Book.new(book_params) if @book.save redirect...
true
e8fdb91edb3f2f692c5dc2deade9e7f03a98b8dc
Ruby
joseluistorres/openweathermap-ruby-gdl
/lib/openweathermap-ruby-gdl.rb
UTF-8
322
2.703125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class OpenweathermapRubyGdl attr_accessor :url def initialize(url) @url = url || 'http://api.openweathermap.org/data/2.5/weather?id=4005539' end def get_response call_url(@url) end def call_url(url) Net::HTTP.get(URI.parse(url)) end def parse_response JSON.parse get_response end en...
true
1b1a12853c4521f469ffed8778061c922447f8e8
Ruby
cheenwe/pbs_dc
/app/models/core/village.rb
UTF-8
4,273
2.59375
3
[]
no_license
class Core::Village < ApplicationRecord second_level_cache expires_in: 1.year belongs_to :street, class_name: "Core::Street", foreign_key: :street_code def full_name name = street.area.city.province.name + street.area.city.name + street.area.name + street.name + self.name address = name.re...
true
552341ac532ef453a4bcafce3de09ba0b071790e
Ruby
LandRegistry/common-dev-env
/scripts/provision_custom.rb
UTF-8
2,483
2.796875
3
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
require_relative 'utilities' def create_custom_provision(root_loc) return if File.exist?("#{root_loc}/.custom_provision.yml") # Create the base file structure puts colorize_green("Did not find a .custom_provision file. I'll create a new one.") custom_file = { 'version' => '1', 'applications' => [] }...
true
fe679ababec6c3e88f3ebcc62d28cb0070095bc9
Ruby
BJSummerfield/Prework
/html/Episode4/song.rb
UTF-8
441
3.59375
4
[]
no_license
class Song def initialize(title, artist, duration, lyrics) @title = title @artist = artist @duration = duration @lyrics = lyrics end def title @title end def artist @artist end def duration @duration end def lyrics @lyrics end def play `say #{@lyrics}` end def friendly_duration minutes = (@du...
true
5db76f3a461fd7473b78be59d23ccb4e3c076671
Ruby
Etsap/my-advent
/adventofcode2018/problem08.rb
UTF-8
854
3.75
4
[]
no_license
input = "" File.open("input08.txt", 'r') {|f| input = f.read} def depthfirst(tree, metadata_sum = 0, i = 0) child_count, metadata_count, node_value = tree[i], tree[i+1], 0 i += 2 children = [] child_count.times do metadata_sum, child_value, i = depthfirst(tree, metadata_sum, i) ...
true
78e80be6bc8eb0ea532714051063d13016e1361c
Ruby
mboeh/roombox
/lib/roombox/vorbis-input.rb
UTF-8
1,264
2.546875
3
[ "MIT" ]
permissive
require 'roombox/plugin' begin require 'vorbisfile' rescue LoadError raise Roombox::PluginError, "Ruby-VorbisFile is required to use VorbisInput." end module Roombox class VorbisInput < InputPlugin def initialize @vf = Ogg::VorbisFile.new end def name "ogg-vorbis" end def ...
true
49d9db808526df322c5d98a858cbc7bcb8654081
Ruby
chriswigington/ttt-4-display-board-rb-q-000
/lib/display_board.rb
UTF-8
288
3.53125
4
[]
no_license
# Define display_board that accepts a board and prints # out the current state. def display_board(xox) line = "-----------" puts " #{xox[0]} | #{xox[1]} | #{xox[2]} " puts line puts " #{xox[3]} | #{xox[4]} | #{xox[5]} " puts line puts " #{xox[6]} | #{xox[7]} | #{xox[8]} " end
true
8d2e44e2223058b3b8030838ab7ec6ff801b5b74
Ruby
evgenyneu/siba-source-mongo-db
/lib/siba-source-mongo-db/db.rb
UTF-8
3,999
2.609375
3
[ "MIT" ]
permissive
# encoding: UTF-8 module Siba::Source module MongoDb class Db HIDE_PASSWORD_TEXT = "****p7d****" include Siba::FilePlug include Siba::LoggerPlug attr_accessor :settings def initialize(settings) @settings = settings check_installed end d...
true
fcbcb04a3f657e8e73a850a1330feeaae22de465
Ruby
blnkt/cyoa-1.1
/spec/chapter_spec.rb
UTF-8
1,336
2.71875
3
[]
no_license
require 'spec_helper' describe Chapter do it { should have_and_belong_to_many :adventures} it { should have_many :choices } it { should belong_to :parent_chapter } # describe '#add_episode' do # it "add an episode text to a chapter" do # unexpected_astronaut = Chapter.create({prompt: "Unexpected Astronaut...
true
b87d75e1d404d2df71b1d3cd4ad69a00495990e2
Ruby
Bashalir/thehackingproject
/mini_jeu_POO/spec/player_spec.rb
UTF-8
2,995
3.296875
3
[]
no_license
# frozen_string_literal: true require 'player' describe 'Player' do before do @player1 = Player.new('José') @player2 = Player.new('Mourinho') end it 'Create a player with name is "José" and have 10 life points' do expect(@player1.name).to eq('José') expect(@player1.life_points).to eq(10) end ...
true
82bbc264f66830794d98eede61c755bfbfb34a97
Ruby
annalanigan/pub_classes_lab
/customer.rb
UTF-8
249
3.09375
3
[]
no_license
class Customer attr_reader :customer_name, :wallet def initialize(customer_name, wallet) @customer_name = customer_name @wallet = wallet end def buy_drink(pub, drink) pub.sell_drink(drink) @wallet -= drink.price end end
true
a7cc8e8e8443814840b881b143d4a392cf1b59e8
Ruby
MooseandSquvirrel/backendSeleniumBot_demo
/bandClass.rb
UTF-8
11,397
3.765625
4
[]
no_license
class Band @@stringsHash = {:band_name => "Enter Event Name:", :start_date => "\nEnter starting date of event:\n(ex: for June 21, 2019 enter: 21/06/2019)\n", :total_days => "\nEnter number of days for the event: (ex: 4)", :band_num => "\nEnter BAND number:", :brand_name => "\nEnter bRand ...
true
76e433082972c1c446c83daa7a419b727169c5be
Ruby
sonialin/launchschool
/Exercises/101-109 Small Problems/Easy 2/04_years_until_retire.rb
UTF-8
544
4.1875
4
[]
no_license
def get_year_to_retire(years_remaining) year_to_retire = Time.now.year + years_remaining end def years_remaining(age, retire_age) years_from_now = retire_age - age end puts "What is your age?" current_age = gets.chomp.to_i puts "At what age would you like to retire?" age_to_retire = gets.chomp.to_i puts "It's "...
true
4a691272a7d668385f004c8e59977b6ff7969bf1
Ruby
dcrosby42/rschema_hamster
/doc/example.rb
UTF-8
2,499
2.71875
3
[ "Apache-2.0" ]
permissive
require_relative "../spec/environment" module OrderReport; end module OrderReport::RubySchema Name = String Id = Integer Dollars = BigDecimal Totals = { owed: Dollars, order_total: Dollars, delivery_fee: Dollars, market_fee: Dollars, } OrderRow = { order_id: Id...
true
53ea57cc16dcc351df2d479b7a7cea99094fe845
Ruby
Pignataro67/looping-loop-v-000
/looping.rb
UTF-8
90
2.6875
3
[]
no_license
def looping #your code here loop do puts "Wingardium Leviosa" end end #call your method here looping
true
28a1fa994eb373a0324aacb2e40bfb0baf90509f
Ruby
discourse/pups
/lib/pups/docker.rb
UTF-8
1,691
2.765625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'shellwords' class Pups::Docker class << self def generate_env_arguments(config) output = [] config&.each do |k, v| if !v.to_s.empty? output << "--env #{k}=#{escape_user_string_literal(v)}" end end normalize_output(output) ...
true
639a79cf3c8984ae0661a393d307962855e5b696
Ruby
Professor322/snow_crash
/level09/Resources/decrypt.rb
UTF-8
295
2.828125
3
[]
no_license
file = File.open("token") file_data = file.read file.close #delete '\n' file_data = file_data.bytes.first file_data.bytes.size - 1 result = [] for i in 0..file_data.length - 1 _new_char = file_data[i].ord - i print "#{_new_char < 0 ? (255 + _new_char).chr : _new_char.chr }" end print "\n"
true
c8884f3777bc476534984f6ffb4e99d88a189871
Ruby
Vilelab/Treinadev
/tipos_de_dados.rb
UTF-8
408
3.46875
3
[]
no_license
#tipos de dados basicos em Ruby class TiposDeDados def ola_mundo return "Olá Mundo" end def um_numero return 1 end def um_decimal return 10.5 end def verdadeiro? return true end def falso? return false end def array_vazio return v = [] end def array_com_um_elemen...
true
ba6a8196959b023b025cd484fe37142c6e8bd65c
Ruby
cnsuhao/libipc-1
/src/ipcc/ipcc.rb
UTF-8
17,576
2.671875
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env ruby # # Copyright (c) 2015 Mark Heily <mark@heily.com> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS ...
true
9210d722c7f1c5e143455ac14eef9daba1906fd3
Ruby
philomory/cellgrid
/experiment/content_test.rb
UTF-8
606
2.640625
3
[]
no_license
require 'test/unit' require 'cellgrid' class ContentTest < Test::Unit::TestCase def setup @cell_klass = cell_klass = Class.new(CellGrid::Cell) do has_one :foo, :bar has_many :baz end grid_klass = Class.new(CellGrid::Grid) { composed_of cell_klass } @foo_class = Class.new(CellGrid::Con...
true
37d223800576639d98efc2bd6f66bdbe3535e69e
Ruby
djiwondee/Ruby20MinHelloWorld
/HelloWorld.ruby
UTF-8
207
3.65625
4
[]
no_license
class HelloWorldSayer def hello_world yield "Hello" yield "World" yield "from Ruby" end end sayer = HelloWorldSayer.new sayer.hello_world { |message| puts message.swapcase }
true
1989442a16d5364f50847270a1b2a5ebc8631de8
Ruby
motmotchat/libmotmot
/test/netproxy.rb
UTF-8
2,999
2.59375
3
[]
no_license
#!/usr/bin/env ruby require 'eventmachine' require 'msgpack' # This connection has a "base" lag $basedelay = rand(5..300) $quiet = ARGV[2] == 'quiet' $all = [] def reschedule q, cb EM::next_tick do q.pop &cb end end module DelayProxy def initialize *args # First, how many milliseconds (ish) should we...
true
3957272488d7adf175aea5ce7ea3461deae39c5e
Ruby
angeloxenakis/many-to-many-shopping
/console.rb
UTF-8
381
2.796875
3
[]
no_license
require 'pry' require_relative "./item.rb" require_relative "./user.rb" require_relative "./purchase.rb" i1 = Item.new("dope shirt", 25) i2 = Item.new("sick pants", 55) i3 = Item.new("very rare jordans", 300) u1 = User.new("David") u2 = User.new("Cori") u3 = User.new("Nestor") Purchase.new(i1, u1) Purchase.new(i3, ...
true
7a4499cdf86768e50ddbf0e1b1819d3de3f8ea20
Ruby
mcanevet/puppet-one
/lib/puppet/provider/oneimage/oneimage.rb
UTF-8
9,395
2.515625
3
[ "Apache-2.0" ]
permissive
require 'rexml/document' require 'tempfile' require 'erb' Puppet::Type.type(:oneimage).provide(:oneimage) do desc "oneimage provider" commands :oneimage => "oneimage" mk_resource_methods # Create a network with onevnet by passing in a temporary template. def create file = Tempfile.new("oneimage-#{reso...
true
442b2d40c2560727e2219056eb52c94c073c6cf4
Ruby
timkaboya/thousand-days
/doc/rapidmag.rb
UTF-8
872
2.625
3
[]
no_license
#! /usr/bin/ruby require 'haml' require 'kramdown' require 'pathname' class Doc attr_reader :id, :name def initialize id, pth @id = id @path = pth @name = pth.gsub(/\.haml$/, '').gsub(/\.txt$/, '') #.gsub(/\W/, ' ') end def to_html statdir = Pathname.new((ENV['STATIC_DIR'] || '/static/')....
true
5046d9bd37a8ed71b7aa7f5d9dac8342d87e2f58
Ruby
NYHolzer/ruby-music-library-cli-online-web-pt-011419
/lib/artist.rb
UTF-8
648
3.171875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative '../lib/concerns/memorable.rb' require_relative '../lib/concerns/findable.rb' require 'pry' class Artist attr_accessor :name, :songs extend Concerns::Memorable::ClassMethods, Concerns::Findable include Concerns::Memorable::InstanceMethods @@all = [] def initialize(name) @nam...
true
3f80968df8d5d1a6e2dca1ef32a0689fba842a88
Ruby
goatshriek/wrapture
/test/test_template.rb
UTF-8
5,637
2.625
3
[ "Apache-2.0" ]
permissive
# SPDX-License-Identifier: Apache-2.0 # frozen_string_literal: true # Copyright 2020 Joel E. Anderson # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/...
true
3f955fb8ac5f99bfcde0560718a629fc8a612b26
Ruby
Chulstro/final_b2_2005
/app/models/flight.rb
UTF-8
348
2.53125
3
[]
no_license
class Flight < ApplicationRecord validates_presence_of :number, :date, :time, :departure_city, :arrival_city belongs_to :airline has_many :passenger_flights has_many :passengers, through: :passenger_flights def minor_count passengers.where("age < 18").count end def adult_count passengers.where("...
true
504acfa325b8156b848404ad08b9e53a9c0f0339
Ruby
kleopatra999/gsmetrics
/lib/gsmetrics/gsmetrics.rb
UTF-8
1,599
2.78125
3
[ "MIT" ]
permissive
require 'google_drive_v0' module GSMetrics class Session def initialize email, password @email = email @password = password end def worksheet doc_title, worksheet_id Worksheet.new doc_title, worksheet_id, @email, @password end end class Error < StandardError end private cl...
true
b1e6e8424702502e35b1901c092921209fe9315a
Ruby
DMscotifer/karaoke_coding
/guests.rb
UTF-8
600
3.296875
3
[]
no_license
require("pry") class Guest attr_accessor :name, :in_room, :wallet, :favourite_song def initialize(name, in_room, wallet, favourite_song) @name = name @in_room = in_room @wallet = wallet @favourite_song = favourite_song end def check_in(in_room) @in_room = in_room end def check_out() @in_roo...
true
798c522c9e0c8059bab2f9a5ba15b8f81e4e39b6
Ruby
kristinpeterson/hardruby
/ex33.rb
UTF-8
617
4.28125
4
[]
no_license
puts "what the fuck are you looking at? enter a number: "; userinput = gets.to_i puts "now enter a number to increment by, damnit: "; increment=gets.to_i def loopy(userinput, increment) i = 0 numbers = [] # for i in (0..userinput-1) ...another option, no longer need increment var as it will cycle through the range...
true
913d5ecb7996daa9c74446450d6b23821cbe035d
Ruby
dkulback/flash_cards
/spec/round_spec.rb
UTF-8
5,683
3.390625
3
[]
no_license
require 'rspec' require './lib/card' require './lib/turn' require './lib/deck' require './lib/round' RSpec.describe Round do it 'exists' do card_1 = Card.new("What is the capital of Alaska?", "Juneau", :Geography) card_2 = Card.new("The Viking spacecraft sent back to Earth photographs and reports about the s...
true
b625e1019b6a66a3c5f4d32e864ca4c3a150cf62
Ruby
sarahkwak/interview_prep
/algorithm/factorial.rb
UTF-8
99
3.25
3
[]
no_license
def factorial(num) if num == 1 return 1 end num * factorial(num-1) end p factorial( 11 )
true
68fcf1cb960313c25157b60fe3bcbe5b9d1ae656
Ruby
feleoterio/exercicio
/02_AnoBisexto/exercicio02.rb
UTF-8
264
3.421875
3
[]
no_license
def div(number, divi) #by Deverso #modulo(1) retorna o resto (number.to_f / divi).modulo(1).zero? end def valid(number) ret = false if div(number, 4) if div(number, 100) if div(number, 400) ret = true end else ret = true end end ret end
true
816e488b5d32cf213a2a261b72bacf2895ef47ef
Ruby
ToniRib/black_thursday
/lib/merchant_repository.rb
UTF-8
634
3.046875
3
[]
no_license
class MerchantRepository def initialize(merchants) @merchants = merchants end def all merchants end def find_by_id(id) merchants.find { |merchant| merchant.id == id } end def find_by_name(name) merchants.find { |merchant| merchant.name.downcase == name.downcase } end def find_all_b...
true
b45f47d5338a5022e8ad4b6ee1b543f17c6ff0bc
Ruby
Tanya163/Ruby_scripts
/prog22.rb
UTF-8
768
4.5
4
[]
no_license
# Q-22 Create a class 'Name' with two attributes firstname and lastname. Neither of them # can be blank and the first letter of firstname must be capital. Implement using 'raise'. # Try using custom Exceptions. # [input] # manoj sharma # [output] # Firstname must start with uppercase letter class Name attr_access...
true
8dbee22630cb907839eb7d35e99814e7991645f0
Ruby
LDCyril/Ruby-pr--parcours-THP
/exo_17.rb
UTF-8
321
3.53125
4
[]
no_license
puts "Bonjour utilisateur, quel est ton âge?" print ">" age = gets.chomp.to_i naissance = 0 until age == 0 if age == naissance puts "Il y #{age} ans, tu avais la moitié de l'âge que tu as aujourd'hui." else puts "Il y a #{(2019 - (2019 - age))} ans, tu avais #{naissance} ans!" end age -= 1 naissance += 1 end
true
3ea9f5be9c8308a6297570c0570fb7885fd25448
Ruby
miamiruby/tdd_calculator
/spec/calculator_spec.rb
UTF-8
1,303
3.109375
3
[]
no_license
require_relative '../lib/calculator' require 'byebug' RSpec.describe "Calculator" do before(:each) do @calc = Calculator.new end it "can moo" do expect(@calc.cow_says).to eq('mooo') end it "can add two numbers" do expect(@calc.add(2, 2)).to eq(4) expect(@calc.add(3, 2)).to eq(5) expect(@c...
true
9632843c96b62f028efb96ae7a54ee32ae356413
Ruby
scottsek/learn_to_program
/PreCourse/angryboss.rb
UTF-8
115
3.015625
3
[]
no_license
puts 'WHADDAYA WANT!' wanted_thing = gets.chomp puts 'WHADDAYA MEAN "'+ wanted_thing.upcase + '"?!? YOU\'RE FIRED'
true
ccbebf997650bf046a5cf05795b84c1a943a4e0c
Ruby
shafiqam/leetcode
/ruby/binary_search/search_in_rotated_sorted_array.rb
UTF-8
564
3.6875
4
[]
no_license
# @param {Integer[]} nums # @param {Integer} target # @return {Integer} def search(nums, target) # O(logn), O(1) l, r = 0, nums.length-1 while l <= r mid = (l+r)/2 if target == nums[mid] return mid end # left sorted portion if nums[l] <= nums[mid] if target > nums[mid] || target <...
true
b92057d2457bf3de4c52edcec68b7c6b019724a9
Ruby
carlosbrando/melbourne
/spec/lib/parser/op_asgn_spec.rb
UTF-8
19,273
2.6875
3
[]
no_license
require File.dirname(__FILE__) + '/../../spec_helper' describe Melbourne::Parser do it 'should correctly parse "a &&= 8"' do ruby = 'a &&= 8' ast = {:opassignand=> {:@line=>1, :@left=>{:localvariableaccess=>{:@variable=>nil, :@name=>:a, :@line=>1}}, :@right=> {:localvariableassi...
true
29f5cdbda0668117e117357e190e9775c052e26c
Ruby
ymhuang0808/ruby-self-practice
/procs.rb
UTF-8
309
3.625
4
[ "Unlicense" ]
permissive
p1 = lambda { puts "Hello world!" } p1.call p2 = lambda { "Hello Ruby!" } puts p2.call def call_proc proc puts "===== START =====" proc.call puts "===== END =====" end p3 = lambda do 10.times do |t| puts "#{t}" end end call_proc p3 p4 = lambda { |x| puts "x = #{x}" } p4.call "Qooooooo"
true
b1e77fafc99867e6b8c4223eff17743182435612
Ruby
jackdempsey/pancake
/lib/pancake/middleware.rb
UTF-8
14,088
3.078125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Pancake # Provides a mixin to use on any class to give it middleware management capabilities. # This module provides a rich featureset for defining a middleware stack. # # Middlware can be set before, or after other middleware, can be tagged / named, # and can be declared to only be active in certain t...
true
c8c2f535ae37a03da8ef03fc38d712a967e05225
Ruby
ftodoroski/ttt-8-turn-ruby-intro-000
/lib/turn.rb
UTF-8
1,113
4.25
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def display_board(board) puts " #{board[0]} | #{board[1]} | #{board[2]} " puts "-----------" puts " #{board[3]} | #{board[4]} | #{board[5]} " puts "-----------" puts " #{board[6]} | #{board[7]} | #{board[8]} " end def input_to_index(user_input) converted_user_input = user_input.to_i - 1 end # Check the nu...
true
bc7970cc5c3b4d8b90000611f0b48ce78d1188fa
Ruby
jetpackpony/coursera-algorithms
/week5/ruby/spec/graph_vertex_spec.rb
UTF-8
1,067
2.90625
3
[]
no_license
require_relative "../lib/graph_vertex" describe Graph::Vertex do let(:vertex) { Graph::Vertex.new } describe "#has_edge_with" do it "returns nil false when there is no edge" do expect(vertex.has_edge_with 1).to be false end it "returns true if the edge exists" do vertex.add_edge 1, 1 ...
true
50c07f684537d0e87f072e7d8bda07ab4dd715cd
Ruby
izenecloud/driver-ruby
/bin/batchCreateAndSearch.rb
UTF-8
2,391
2.515625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env ruby #--- # create documents into collection and perform batch search. #+++ # require File.join(File.dirname(__FILE__), "common") require 'rubygems' require 'optparse' require 'json' sf1 = create_connection collectionName = "example" randfile_name = "./randContentFile" randlines = 0 # document num tha...
true
4b1bd323041e590a270bc4a446942684a633c32a
Ruby
Eduardo123Andrade/exercicios-ruby
/collections.rb
UTF-8
173
3.171875
3
[]
no_license
hash = {} hash[:cidade] = 'Paulista' # puts hash array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] novoArray = array.map do |a| a * 2 end # puts array puts !!hash[:estado]
true
ba3a25d4fb6a4f910a8ffe1a196a2ffc3f853c81
Ruby
huasmc/classes_practice
/specs/student_class_spec.rb
UTF-8
1,310
3.0625
3
[]
no_license
require('minitest/autorun') require('minitest/rg') require_relative('../student_class.rb') class TestCodeClanStudent < Minitest::Test def setup @student = CodeClanStudent.new('Huascar', 16) @student2 = CodeClanStudent.new('Miguel', 16) end def test_student_name assert_equal('Huascar', @student.stud...
true
9738b024b3edb11708d36ebf7f4ab13bdd5c8f9e
Ruby
vrameshk/test
/app/models/todo.rb
UTF-8
935
2.703125
3
[]
no_license
class Todo < ActiveRecord::Base validates :todo_text, presence: true validates :due_date, presence: true validates :todo_text, length: { minimum: 2 } belongs_to :user def due_today? due_date == Date.today end def self.of_user(user) all.where(user_id: user.id) end def self.overdue where...
true
2480404aef9f32a0336579cff194a4dadbfb0049
Ruby
michaelroxas/backend-activities
/smallest-integer.rb
UTF-8
400
4.40625
4
[]
no_license
### 09-20-2021 ### Find the smallest integer in the array # Do not use `.min` # Do not use `.sort` array1 = [34, 15, 88, 2] array2 = [34, -345, -1, 100] def find_smallest_int(arr) smallest = arr[0] arr.each do |num| if num < smallest smallest = num end end puts "smallest in #{arr} is ...
true
0e49ad07d038b7ad38629f50901ced04d082aafa
Ruby
aviflombaum/mixtapeapp
/db/seeds.rb
UTF-8
1,987
2.84375
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
true
40bd98704e22a8d19b1b451c9279078660408ee0
Ruby
mosen/puppet-plist
/lib/puppet/provider/plist/plistbuddy.rb
UTF-8
3,092
2.921875
3
[]
no_license
Puppet::Type.type(:plist).provide :plistbuddy, :parent => Puppet::Provider do desc "This provider alters plist values using the PlistBuddy(8) command line utility. Because of the way that PlistBuddy deals with types, it cannot convert an existing Plist key from one type to another. The key must first be removed...
true
f396ecdf4d97a4409fc84752c20acc3d14418919
Ruby
AyanaZaire/ruby-objects-has-many-through-lab-dc-web-062518
/lib/patient.rb
UTF-8
816
3.5625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Patient @@all = [] attr_accessor :name, :doctor def initialize(name) @name = name @@all << self end def self.all @@all end #takes in an argument of a doctor and a date and creates a new appointment. The appointment should know that it belongs to the patient. def new_appointment(d...
true
f8fe43841265d5f1f7f8b37943a98d0b83f4b273
Ruby
rich0024/anagram-detector-online-web-pt-102218
/lib/anagram.rb
UTF-8
290
3.421875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Your code goes here! class Anagram attr_accessor :anagram def initialize(anagram) @anagram = anagram end def match(test) arr1 = [] test.each do |words| if words.split("").sort == anagram.split("").sort arr1 << words end end arr1 end end
true
5ba3011396bb58e891955670c9b58f19cbd60287
Ruby
bramleyjl/learn_ruby
/01_temperature/temperature.rb
UTF-8
173
3.328125
3
[]
no_license
def ftoc(temperature) convert = 5/9.to_f (temperature.to_f-32.0)*convert end def ctof(temperature) convert = 9/5.to_f (temperature.to_f*convert)+32 end print ctof(0)
true
9029fccf5d6a44cffc4335da1fc411513a7ad94e
Ruby
burtlo/dutchman
/lib/dutchman/application.rb
UTF-8
369
2.640625
3
[ "MIT" ]
permissive
require "dutchman/ghost_writer/ghost_writer" module Dutchman class Application def initialize(params) @name = params.delete(:name) end attr_reader :name def write(text) _write(name,text,:moderate) end private def _write(name,text,speed) GhostWriter.write(application:...
true
bde7a8a13e7fb24b272ea7db281e1382bdc971a6
Ruby
Ellmo304/WDI-HOMEWORK
/Ellmo304/w09d04/ruby-calculator/main.rb
UTF-8
2,482
3.984375
4
[]
no_license
continue = 'y' while continue == "y" p "Hello, I'l be your calculator for today! What kind of calculation would you like to do?" p "Type b for basic calculation or a for advanced. Type s for stamp duty calculator" user_choice = gets.chomp case user_choice when "b" p "Basic. Type a for addition, s for subt...
true
cbe2fa86c70d2ca6c49c4bc06098842376175af1
Ruby
majdeddine/Battle
/spec/game_spec.rb
UTF-8
1,231
3.125
3
[]
no_license
require 'game' describe Game do subject { described_class.new('player', 'player', player_class: player_class) } let(:player) { double(:player1, attacked: nil, name: 'majd', hp: 100 ) } let(:player_class) { double(:player_class, new: player) } describe '#get' do before(:each) { subject.players.push(:player...
true
a00917e063f897afc5d7de442db16b8516eaacbf
Ruby
thomasjlee/blackjack
/spec/player_spec.rb
UTF-8
6,484
3.203125
3
[]
no_license
require 'spec_helper' require_relative '../lib/player' require_relative '../lib/card' RSpec.describe Player do let(:ace) { Card.new(:hearts, :ace, [11, 1]) } let(:two) { Card.new(:hearts, :two, 2) } let(:three) { Card.new(:hearts, :three, 3) } let(:four) { Card.new(:hearts, :four, 4) } let(:five) { Car...
true
5b3814e80de5832225daae47405e386e61edbce4
Ruby
KimWren2009/Launch
/RB100/5-Loops_Iterators/conditional_while_loop_with_next.rb
UTF-8
201
3.9375
4
[]
no_license
# a conditional loop with next x = 0 while x <= 10 if x == 3 next elsif x.odd? puts x end x += 1 end # We use the next reserved word here to avoid printing the number 3 in our loop.
true
9e7084352938c3a1fdbb8b5fa7ec3197b0270d0b
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/cs169/800/feature686/whelper_source/27058.rb
UTF-8
581
3.125
3
[]
no_license
def combine_anagrams(words) anagram_groups = [] words.each do |word| pp(word) if (anagram_groups.length == 0) then anagram_groups.push([word]) next end is_word_added = false anagram_groups.each do |group| if group.is_a?(Array) and (group.first.length == word.length) then ...
true
8006147ccb414af4b2cfa757264b545fc94387e8
Ruby
kristianhelgesen/samurai-crop-server
/transformparams.rb
UTF-8
486
2.640625
3
[ "MIT" ]
permissive
class TransformParams attr_accessor :dx, :dy, :cw, :ch, :a def initialize( params) @dx = 0.0 @dy = 0.0 @cw = 1.0 @ch = 1.0 @a = 0.0 if( params[:dx]!=nil) then @dx = params[:dx].to_f end if( params[:dy]!=nil) then @dy = params[:dy].to_f end if( params[:cw]!=nil) then @cw = ...
true
c18406c329c4f43c83e3e0a4f88281c92d98f289
Ruby
CodingDojo-Ruby-03-17/tibbetts
/Ruby/OOP/bankaccount.rb
UTF-8
1,562
3.828125
4
[]
no_license
class InsufficentFundsError < Exception end class BankAccount attr_reader :checkings, :savings, :total_accounts @@total_accounts = 0 def initialize(checkings=0.0, savings=0.0) @account_number = generate_account_number @checkings = checkings @savings = savings @intrest_rate = 0.01 @@total_a...
true
970a09a0605ae2ba376d09be7ce12011849def19
Ruby
pavanprakash21/daily-challenge
/33/solution.rb
UTF-8
839
3.5
4
[]
no_license
# class Hash # @keys_used = [] # def random_key # @keys_used = [] if @keys_used.size == self.size # key = self.keys[rand(self.size)] # while @keys_used.include?(key) # key = self.keys[rand(self.size)] # end # @keys_used << key # return key # end # end # @qa_pair = { # "12*12" => "...
true
9e580a7ea780bc650759de2b956e1abbdd29d994
Ruby
OtavioPinheiro/AprendendoRuby
/classe_abstrata/abstract.rb
UTF-8
1,195
3.078125
3
[]
no_license
module Abstract def self.included(included_class) metaclass = class << included_class; self; end metaclass.send :define_method, :inherited do |inherited_class| trace_class_creation do #Puxa todos os métodos da classe cujo este módulo foi incluído (classe abstrata) abstract_me...
true
47abe74fa748d139eb896181f7250a2f5faedb5c
Ruby
upstill/RecipePower-source
/app/helpers/images_helper.rb
UTF-8
5,101
2.515625
3
[]
no_license
module ImagesHelper # Define an image tag which responds reasonably to image failure using pics.js. # url_or_object: either a string, or a decorator, or an object (as long as it responds to imgdata and fallback_imgdata) # opts_in are passed to the image_tag, except: # - :fill_mode causes the image to be dynami...
true
f4f5a1caa752999f7f6d35248cf1c3110bfaeda4
Ruby
whimsicurl-creations/ruby
/ruby_challenges/always_three_argument.rb
UTF-8
158
3.859375
4
[]
no_license
def math_magic(num) (((num + 5) * 2 - 4) / 2 - num) end puts "Give me a number" given_number = gets.to_i puts "Always " + math_magic(given_number).to_s
true
742fb8f9322c99b80724567e57349258dd132df5
Ruby
Tsutomu19/studying_ruby
/test/rgb_test.rb
UTF-8
1,198
3.40625
3
[]
no_license
require 'minitest/autorun' require './lib/rgb' class RgbTest < Minitest::Test def test_to_hex assert_equal '#000000', to_hex(0,0,0) assert_equal '#ffffff', to_hex(255,255,255) end end '0'.rjust(5) '0'.rjust(5,'0') '0'.rjust(5,'_') 0.to_s(16).rjust(2,'0') 255.to_s(16).rjust(2,'0') def to_h...
true
4283047b074535ac1ebabb1ed8b3df8e97761247
Ruby
kenigbolo/strs-taxi
/app/controllers/api/drivers_controller.rb
UTF-8
3,772
2.515625
3
[]
no_license
module Api class DriversController < ApiController def login logger.debug user = User.find_by(email: params[:user][:email])#.try(:authenticate, params[:user][:password]) if user driver = Driver.find_by(user_id: user.id) if driver render json: {data: {user: user, driver: ...
true
5118f62fb816a2428cc21729f474a5224161ad96
Ruby
hjensen1/euler-project
/79.rb
UTF-8
746
3.359375
3
[]
no_license
require './functions.rb' # this solution assumes each digit appears only once. This is obviously true in the example, # and a more general solution seems much harder to implement list = read_input("input_79.txt").flatten hash = Hash.new{ |h, k| h[k] = [[],[]] } list.each do |s| hash[s[1]][0] << s[0] unless hash[s[1...
true
f90d09fcc7a754f8c0e9f467c137ceb129f31aae
Ruby
MaratMikushkin/RubequeTasks
/lib/lambda_lambda_lambda.rb
UTF-8
199
2.890625
3
[]
no_license
class LambdaLambdaLambda def initialize @even_check = Proc.new { |x, *other| x % 2 == 0 && (other.length == 0 || \ other[0] % 2 == 0) } end def even_check @even_check end end
true
748e5f3da1c0af42ee78a46ac83b7e47076e971d
Ruby
odanylevskyi/algorithms
/solutions/rob.rb
UTF-8
329
3.375
3
[ "MIT" ]
permissive
def rob(nums) len = nums.size return 0 if len == 0 return nums[0] if len == 1 i = 2 while i < len do if i - 3 < 0 nums[i] += nums[i-2] else nums[i] = [nums[i-2]+nums[i], nums[i-3]+nums[i]].max end i+=1 end return [nums[len-1], nums[len-2]].max end puts rob([2, 1, 3, 4, 6, 7,3,...
true
f5fc29626ebb0815db90a0827bcd6ed4b812b29a
Ruby
h4hany/yeet-the-leet
/algorithms/Easy/169.majority-element.rb
UTF-8
684
3.53125
4
[]
no_license
# # @lc app=leetcode id=169 lang=ruby # # [169] Majority Element # # https://leetcode.com/problems/majority-element/description/ # # algorithms # Easy (58.86%) # Total Accepted: 686.7K # Total Submissions: 1.2M # Testcase Example: '[3,2,3]' # # Given an array of size n, find the majority element. The majority eleme...
true
f871fb6704525447346f39dfec74d177552a2223
Ruby
tiffythinhdang/app_academy_W4D3
/Chess/piece.rb
UTF-8
577
3
3
[]
no_license
require "singleton" class Piece attr_reader :color, :board, :pos def initialize(color, board, pos) @color = color @board = board @pos = pos end def inspect self.symbol end def to_s end def empty? end def valid_moves self.moves || self.move_dirs end def pos=(val) ...
true
ae4464c015125e5c9665df0a263e7e36100229fd
Ruby
changeworld/hackerrank
/domains/algorithms/warmup/time-conversion.rb
UTF-8
284
3.15625
3
[]
no_license
#!/bin/ruby time = gets.strip if time[0, 2] == '12' then puts '00' + time[2, 6] if time[-2..-1] == 'AM' puts '12' + time[2, 6] unless time[-2..-1] == 'AM' else puts time[0, 8] if time[-2..-1] == 'AM' puts (time[0, 2].to_i+12).to_s + time[2, 6] unless time[-2..-1] == 'AM' end
true
315ef0215dd92460b9e9075e97bdf1bb3038965e
Ruby
rapid7/rex-socket
/lib/rex/socket/switch_board.rb
UTF-8
6,078
2.828125
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: binary -*- require 'singleton' require 'thread' require 'rex/socket' module Rex module Socket ### # # This class provides a global routing table that associates subnets with Comm # classes. Comm classes are used to instantiate objects that are tied to # remote network entities. For example, the Local ...
true
1243e08ed26c464277bd85451fc642be39239d56
Ruby
evolve2k/rovernavigator
/features/step_definitions/system_steps.rb
UTF-8
1,551
2.625
3
[]
no_license
Given /^I have not yet entered any navigation instructions$/ do end When /^I start the navigation system$/ do @messenger = StringIO.new @system = Navigator::System.new(@messenger) @system.start end Then /^I should see "([^\"]*)"$/ do |message| @messenger.string.split("\n").should include(message) end Given /...
true
3b37ebf2f1ae555cd2a53fce927166559e1ad0b8
Ruby
elviskvalbergs/testcon-amazon
/spec/browser.rb
UTF-8
248
2.609375
3
[]
no_license
class Browser def initialize(type) self.type = type self.driver = Selenium::WebDriver.for type end attr_accessor :type, :driver def self.type return self.type end def self.driver return self.type end end
true
d41e5f053d3d5f41f6ae3398e80713624ac57b8a
Ruby
alawmoradi665/ruby-
/iterator.rb
UTF-8
950
4.59375
5
[]
no_license
# iterators go through each value of an array or a hash. different kinds: # each, map, map!, each_with_index,filter,select,reduce # the syntax for each is: # names = ["ethan", "joe", "mohammad"] # names.each {|name| p name.capitalize} # names.each do |name| # p name.capitalize # end # you can either use the bra...
true
390694117dba7faedf238669a4d101899e873278
Ruby
noahgibbs/roughshod
/exe/roughshod
UTF-8
4,722
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require "rugged" require "trollop" require "json" opts = Trollop::options do opt :number_of_commits, "Maximum number of commits to consider", :type => :integer, :default => 3_000 opt :print_every, "Print a working message every X commits", :type => :integer, :default => 500 opt :touch_penalt...
true
b60e708272ac22a362151fe0982bbc0053a16f23
Ruby
ifpb/exercises
/src/pages/exercises/array-prime-factors/_codes/ruby/response/prime-factors.print.rb
UTF-8
671
4.0625
4
[]
no_license
require_relative 'prime-factors.rb' # Prime Factors # returning an empty array for 1 puts prime_factors(1) puts [] # factoring 2 puts prime_factors(2) puts [2] # factoring 3 puts prime_factors(3) puts [3] # factoring 4 puts prime_factors(4) puts [2, 2] # factoring 6 puts prime_factors(6) puts [2, 3] # factoring ...
true
fd00beb424a0646d0c50e6599d700b2dac53b622
Ruby
pbrisbin/raury
/lib/raury/aur.rb
UTF-8
650
2.578125
3
[]
no_license
require 'uri' require 'net/https' module Raury # represents a resource available on the AUR: pkgbuilds, taurballs, # and rpc call results are all fetched via this class. class Aur AUR = 'aur.archlinux.org' def initialize(path) @uri = URI.parse("https://#{AUR}#{path}") end def fetch ...
true
a2acf6429093f500a2dfd11341ce74a700010b34
Ruby
iraamaro/glimmer-dsl-libui
/examples/basic_table_image.rb
UTF-8
938
2.671875
3
[ "MIT" ]
permissive
# frozen_string_literal: true # NOTE: # This example displays images that can be freely downloaded from the Studio Ghibli website. require 'glimmer-dsl-libui' require 'chunky_png' require 'open-uri' include Glimmer IMAGE_ROWS = [] 50.times do |i| url = format('https://www.ghibli.jp/gallery/thumb-redturtle%03d.pn...
true
168ff528404bb23e8ef1e4f84949b3ad029d6661
Ruby
melvourne/resto
/restaurant.rb
UTF-8
5,125
3.171875
3
[]
no_license
require 'terminal-table' class MenuItem attr_accessor :name, :price, :description def initialize(name, price, description) @name = name @price = price @description = description end end class Entrees < MenuItem end class Mains < MenuItem end class Desserts < MenuItem end class Drinks < MenuI...
true
03c04e317344c6d551b682dae5b53347eb60d791
Ruby
Ohmbrewer/ohmbrewer
/app/models/task.rb
UTF-8
13,166
2.625
3
[]
no_license
require 'rhizome_interfaces/sprout/sprout' require 'rhizome_interfaces/equipment/equipment_states' require 'scheduler/state_machines/task_state_machine' class Task < ActiveRecord::Base include RhizomeInterfaces::EquipmentStates include Scheduler::StateMachines::TaskStateMachine # Tasks are organized in a tree st...
true
13680797840fb26015a27c329c61e6fa2f744d11
Ruby
myrtokonst/fewpjs_arrow_function_shorthand-london-web-career-021819
/prime_numbers.rb
UTF-8
59
2.859375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def prime_number(n) puts "jdfn" end prime_number(5)
true
377c63ccb1c278cb3d95d4d7afe3ff6fa9cf610b
Ruby
isabelcooper/fizzbuzz
/lib/fizzbuzz.rb
UTF-8
133
3.296875
3
[]
no_license
def fizzbuzz(n) result = '' result << 'fizz' if n % 3 == 0 result << 'buzz' if n % 5 == 0 result == '' ? n.to_s : result end
true