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
ea0e0811e6c0b59651648aff9554f068ced3b506
Ruby
tarousinpo/sketchbook
/tarou/ruby_toybox/test.rb
UTF-8
307
3.28125
3
[]
no_license
names = ['sanpo', 'shinpo', 'sunpo', 'senpo', 'sonpo'] monsters = ['GODZILLA', 'KingKong', 'Hedora'] names.each do |name| monsters.each do |monster| puts "#{name} VS #{monster}" result = [name, monster] result.shuffle! puts "Winner #{result[0]} Loser #{result[1]}(◞‸◟)" end end
true
b44141dd372fe67f7440a210baff4d5e8c9c4985
Ruby
wojtekmach/game_of_life
/bin/game_of_life
UTF-8
741
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require "ncurses" require_relative "../lib/game" require_relative "../lib/game_loader" require_relative "../lib/game_printer" game = Game( ' ', ' x ', ' x ', ' xxx ', ' ', ' ', ' ', ' ') Ncurses.initscr Ncurses.nl() Ncurses.noecho()...
true
0ff7ce8592c8edae0d234ceadf8463c52264ac74
Ruby
ChristieRenaud/sinatra-address-book
/address_book.rb
UTF-8
2,420
2.53125
3
[]
no_license
require "sinatra" require "sinatra/reloader" if development? require "sinatra/content_for" require "tilt/erubis" require "redcarpet" require "yaml" require "bcrypt" configure do enable :sessions set :session_secret, "very, very, secret" end before do session[:entries] ||= [] end helpers do def format_phone_n...
true
879c2a304d19f0b5d70920206940e58bb362a2e4
Ruby
perryr16/final_assessment_be_2003
/spec/features/hospitals/show_spec.rb
UTF-8
3,653
2.515625
3
[]
no_license
require 'rails_helper' RSpec.describe "Hospital Show Page" do before :each do @hospital1 = Hospital.create(name:"Grey Sloan Memorial Hospital", address:"123 Save Lives Rd", city: "Seattle", state: "WA", zip: "98101" ) @hospital2 = Hospital.create(name:"Seaside Health & Wellness Center", address:"123 Private ...
true
bb2571a0f1ef8a4c929e59859d96c63724c4609e
Ruby
Arelaxe/qytetet
/QytetetRuby/pkg/QytetetRuby-0.0.1/lib/ModeloQytetet/tablero.rb
UTF-8
3,120
2.828125
3
[]
no_license
# encoding: utf-8 module ModeloQytetet class Tablero # Consultores attr_reader:casillas, :carcel # Constructor sin parámetros que a la vez inicializa # las casillas del tablero def initialize @casillas = Array.new self.inicializar end # Método de ayud...
true
4aa2280995c0a1a16c91ee33745eb6dc474306eb
Ruby
popsun007/Algorithms_and_Data_Structure
/strStr.rb
UTF-8
441
4.03125
4
[]
no_license
# Implement strStr(). # Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. def str_str(haystack, needle) if haystack.nil? || needle.nil? return -1 end 0.upto(haystack.size - needle.size) do |i| j = 0 while j < needle.size unless haystack[i +...
true
0d77d3cfb50646c71c7136592048a02de66ef3bf
Ruby
micahshute/rbtech
/lib/rbtech/concerns/trackable_nodes.rb
UTF-8
1,209
2.75
3
[ "MIT" ]
permissive
module Rbtech::TrackableNodes include Rbtech::HasNodes def original_to_current_mapping @original_mapping ||= (0...@nodes.length).to_a end def current_to_original_mapping @current_mapping ||= (0...@nodes.length).to_a end def add_node(val) original_and_current_position ...
true
bba8696c66a1955c44e90bc2736382c3f2cd5869
Ruby
ColinTheRobot/seedly
/app/controllers/frost_dates_controller.rb
UTF-8
1,705
2.9375
3
[]
no_license
class FrostDatesController < ApplicationController def index end def search render :search end # search_frost_date takes the user input lat and long to find a hash of the nearest weather stations to their locations. # It then returns the raw dates for 90%, 50% and 10% chance of frost at the users location...
true
27e28630ffbf518bc7af59c2974d52d5c6ec43b2
Ruby
V-Gutierrez/ruby-class
/var_const.rb
UTF-8
510
3.40625
3
[]
no_license
XYZ = "I am a constant because I am all in uppercase or SNAKE_UPPER_CASE!" xyz = "I am a variable because I'm able to change and I was declared in lowercase" XYZ = "new value - It changes but it is not the right thing to do and warning is thrown" xyz = "I can change ! " puts XYZ, xyz ####### CONSTANT CLASSES class...
true
6ec088320cf96e7caecf362b67d5700977a4ae0b
Ruby
Nikhila19/PORO
/bin_tree/binary_tree_serialize.rb
UTF-8
1,753
3.421875
3
[]
no_license
class Node attr_accessor :left, :right, :value @left = nil @right = nil @value = -1 end class BinaryTree attr_accessor :root, :fileName, :index, :bt_array EMPTY_NODE = -1 def initialize @fileName = "/Users/nikhila.rao/Documents/Nikhila/Training/PORO/binary_tree_serialize.txt" @root = nil @i...
true
61bce47eabfa3a978e567fb934f0efbd3d4f4fd6
Ruby
perfectritone/coyneye-rails
/app/services/poloniex_feed_subscriber.rb
UTF-8
957
2.71875
3
[]
no_license
require 'faye/websocket' require 'eventmachine' class PoloniexFeedSubscriber CURRENCY_PAIR_IDS = { 'USDT' => { 'ETH' => 149, }, 'USDC' => { 'ETH' => 225, }, } def self.perform @thread.exit if @thread @thread = Thread.new do EventMachine.run do ws = Faye::WebSoc...
true
5bc33209e561c16382332914bbfaab7786f6773d
Ruby
guilded/guilded
/lib/guilded/rails/inactive_record/human_attribute_hint.rb
UTF-8
1,022
2.734375
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
module InactiveRecord class Base class <<self def attr_human_hint(attributes) # :nodoc: #return unless table_exists? attributes.stringify_keys! write_inheritable_hash("attr_human_hint", attributes || {}) # assign the current class to each column that is being assigned a new...
true
543fd1526fee33281dcd4f36e79ab5506edcb64f
Ruby
JiriHartikka/WePa14
/spec/models/user_spec.rb
UTF-8
5,248
2.8125
3
[]
no_license
require 'spec_helper' describe User do it "has the username set correctly" do user = User.new username:"Pekka" user.username.should == "Pekka" end it "is not saved without a password" do user = User.create username:"Pekka" expect(user).not_to be_valid expect(User.count).to eq(0) end d...
true
d11be813fdfb29bec5ca95e2f10f5112d8e4c631
Ruby
Informed/ruby-geometry
/test/line/intersect_x_test.rb
UTF-8
1,164
2.71875
3
[ "MIT" ]
permissive
require 'minitest/autorun' require 'geometry' class IntersectXTest < Minitest::Test include Geometry def test_vertical_non_overlapping l1 = Line.new_by_arrays([0, 0], [0, 1]) l2 = Line.new_by_arrays([1, 0], [1, 1]) assert l1.intersect_x(l2).nil? end def test_vertical_overlapping x = 0 l1 ...
true
ac9926a5de5092a724a4f314dc0790d349007dee
Ruby
IsolatePy/Learn-How-To-Code-With-Ruby
/2- Numbers and Booleans/The_.upto_and_.downto_Methods.rb
UTF-8
219
3.359375
3
[]
no_license
5.downto(1) { |i| puts "Countdown: #{i}" } puts "Next" 5.upto(10) { |i| puts "Countdown: #{i}" } puts "Next" 5.downto(1) do |i| puts "Countdown: #{i}" end puts "Next" 5.upto(10) do |i| puts "Countdown: #{i}" end
true
2f6cb4cbd7bc225d3c7307b9108bedde0aebb3ba
Ruby
joncooper/PE-Solutions
/pe-10.rb
UTF-8
272
3.640625
4
[]
no_license
# PE#10 # Find the sum of all primes below two million require 'mathn' prime_generator = Prime.new prime = 0 sum = 0 while ((prime = prime_generator.next) < 2000000) sum = sum + prime end puts sum # wolframalpha.com # sum primes between 1 and 2000000 # 142913828922
true
a1c72031f001a5997718086dfb9e7d343d96644e
Ruby
keshav-c/algo
/sorting/lib/call_counter.rb
UTF-8
270
3.78125
4
[]
no_license
class Counter attr_accessor :cnt def initialize @cnt=0 end def fib(n) self.cnt += 1 puts "called fib(#{n}), call count is #{cnt}" return n if n <= 1 fib(n-1)+fib(n-2) end end f = Counter.new fib5 = f.fib(5) puts "#{fib5}; #{f.cnt}"
true
45f2db18c9d144eb49e5e2d18411780e4c185fab
Ruby
rfcq/rubystudy
/tipos.rb
UTF-8
216
2.796875
3
[]
no_license
produto = 'Macbook' preco = 5999.33 quantida = 10 disponivel = true puts produto.class puts preco.class puts quantida.class puts disponivel.class puts produto puts preco puts quantida puts disponivel
true
0d07c010286947bf0e35eca4101e8c13ed245844
Ruby
schmich/hearthstone-deckstrings
/lib/deckstrings/deckstrings.rb
UTF-8
16,652
3.265625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'base64' require 'json' module Deckstrings # An error indicating a malformed deckstring. class FormatError < StandardError end # Enumeration of valid format types: wild and standard. class Format include Enum # @!scope class # @return [Format] Wild format. define :wild, 1, 'Wild' ...
true
f78217c2a0ccb59a2e2b6e41198d6a2f0e3886a8
Ruby
mediashelf/bgc-skunkworks
/lib/bgc_services/bgc_auction_sale_service.rb
UTF-8
999
2.640625
3
[]
no_license
require "open-uri" require 'json' require "bgc_services/bgc_service" class BGCAuctionSaleService # Uses BGC Auctions service to retrieve metadata about Auction Sales # @param [String] auction_catalog_id OCN Identifier for Auction Catalog record # @param [JSON] target the target(s) to resolve ids for. Can be ...
true
f2bf31ab2654068e5cbb9150f4d26f48fec0e6a8
Ruby
nmacawile/Events
/test/models/user_test.rb
UTF-8
2,244
2.8125
3
[]
no_license
require 'test_helper' class UserTest < ActiveSupport::TestCase def setup @user = User.new(name: "Foo Bar", email: "foo@bar.baz", password: "password", password_confirmation: "password") end def valid? @user.valid? end test "must be ...
true
6d21287a79a0601b8821a2b6382af65ad64ab45b
Ruby
NikitaSharipov/lesson2
/fibonachi.rb
UTF-8
179
2.5625
3
[]
no_license
fibonachi = [] first = 0 second = 1 while first+second <= 100 do fibonachi.push(first+second) second = first + second first = second - first end puts fibonachi
true
02f287df04646a831a7e46cd5b710b5147cea9fc
Ruby
kailuowang/mvnaid
/lib/user_interface.rb
UTF-8
217
3.140625
3
[]
no_license
class UserInterface def confirm msg puts "#{msg} Y(es)/N(o)" reply = gets yes?(reply) end def yes?(input) input.index(/y/i) == 0 end def prompt msg puts "#{msg}" gets.chop end end
true
24b2460e5e11777c0a41ad7206c1a612e4c9a363
Ruby
retrosync/snooze
/bin/snooze
UTF-8
1,080
2.625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env ruby # encoding: utf-8 $:.unshift(File.expand_path('../lib', File.dirname(__FILE__))) require 'snooze' require 'optparse' ## Variables allowed_actions = ['snooze', 'backtrace', 'ping'] options = {} optparse = OptionParser.new do |opts| # Set a banner, displayed at the top # of the help screen. o...
true
664e0add804eba7fe9de049ae42f4eae48dd03ec
Ruby
deluan/auto-environments
/spec/environment_spec.rb
UTF-8
3,394
2.59375
3
[ "MIT" ]
permissive
require 'spec_helper.rb' describe Environment do before do @mock_env_file = double("file") content = "---\nmachines:\n db:\n - common\n - mysql\n www:\n - common\n - ruby19\n - nginx\n - passenger\nnetwork:\n domain: petshop.example.com\n public_hosts: www" @mock_env_f...
true
3e9bcb13e65ef58383cd38385e8d3b0f319205f8
Ruby
crstreet77/ruby_practice
/ex10.rb
UTF-8
1,440
3.828125
4
[]
no_license
# SINGLE QUOTES CAN ONLY BE USED ON THE INSIDE WHEN COMBINED WITH DOUBLE QUOTES # The next 3 lines are for visual reference when coding and debugging only. puts "" puts "<-----------BEGIN-------------->" puts "" # Enter the start of training code ex4 from Learn Ruby The Hard Way by Zed tabby_cat = "\tI'm tabbed in." p...
true
09e8c93b17fc5f8558fcb2645ba80965b469128c
Ruby
plonk/100knock
/q55.rb
UTF-8
383
3.21875
3
[]
no_license
=begin 55. 固有表現抽出 入力文中の人名をすべて抜き出せ. =end require 'nokogiri' def main doc = File.open('nlp.txt.xml', &Nokogiri.method(:XML)) doc.css('token').select { |tok| tok.css('POS').first.text =~ /\ANNPS?\z/ && tok.css('NER').first.text == 'PERSON' }.each do |tok| puts tok.css('word').first.text end end main ...
true
2570396e960d4e771e99f5ec1d3f79e03fea9fb9
Ruby
fekadesenbeta/guessing-cli-denver-web-060319
/guessing_cli.rb
UTF-8
467
3.953125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Code your solution here! def run_guessing_game puts "Guess a number between 1 and 6." random_number = 10 input = 0 while input != 'exit' random_number = rand(6) input = gets.chomp if random_number.to_s == input puts "You guessed the correct...
true
ee0f84889bd93a1273c9776bbaaa4711425be876
Ruby
harperbd/lunch_lady
/cart.rb
UTF-8
402
3.734375
4
[]
no_license
class Cart def initialize @cart_items = [] end def add_item(item) @cart_items.push(item) end def display_cart items = "" total = 0 @cart_items.each do |item| items += item.name + ", " total += item.price end print "\nYour order consists of:\n" print items[0, it...
true
147fcfcb9c939dacabd2d385e441ad86b1e97fc1
Ruby
timfel/ruby_image_viewer
/viewer.rb
UTF-8
422
2.515625
3
[]
no_license
$LOAD_PATH << File.dirname(__FILE__) require "ffi" require "bmp" require "sdl" sdl = SDL.new bmps = Dir["#{File.expand_path(ARGV[0])}/*.bmp"].sort.map { |file| BMP.new(file) } i = 0 sdl.draw_pixels bmps[0].width, bmps[0].height, bmps[0].depth, bmps[0].data while (k = sdl.get_event) != 0 next if k == 2 i = (i + ...
true
eca1bb27500dca8d660cddcbe1f5c057adf26781
Ruby
livinginberlin/fortuneteller
/myrun.rb
UTF-8
2,090
4.25
4
[]
no_license
# User can enter their name and program responds, "Hi, [user name]" puts "What's your name?" print ">" username = $stdin.gets.chomp puts "Welcome, #{username}" # User can input age and program repeats information back to user puts "How old do you feel today?" print ">" user_age = $stdin.gets.chomp.to_i # if ...
true
ea24a8e9d157d014f721258d4a2611ce8c78d2aa
Ruby
bgoodspeed/dopewars
/lib/menu/selectors/filtered_inventory_menu_selector.rb
UTF-8
739
2.609375
3
[]
no_license
# To change this template, choose Tools | Templates # and open the template in the editor. class FilteredInventoryMenuSelector include DrawableElementMenuSelectorHelper attr_accessor :menu_item def initialize(game) @game = game end def selection_type InventoryItem end def filter(what, selection...
true
85cea6d6bb96795dbfbf98cfcc85455406f7eb98
Ruby
priyankshah217/pact_broker
/lib/pact_broker/pacts/verifiable_pact_messages.rb
UTF-8
3,191
2.609375
3
[ "MIT" ]
permissive
module PactBroker module Pacts class VerifiablePactMessages extend Forwardable READ_MORE_PENDING = "Read more at https://pact.io/pending" READ_MORE_WIP = "Read more at https://pact.io/wip" delegate [:consumer_name, :provider_name, :head_consumer_tags, :pending_provider_tags, :non_pending...
true
35adcf637d76dce42d189da55a12bafa12336dcb
Ruby
lomefin/subscriptor
/app/models/tier.rb
UTF-8
848
3
3
[]
no_license
class Tier < ActiveRecord::Base belongs_to :charge attr_accessor :price_per_unit_cents def price_per_unit Rails::logger.debug "Getting Price per unit (cents): " + price_per_unit_cents.to_s @price_per_unit_cents/100 end def price_per_unit=(value) Rails::logger.debug "Price per unit: " + value.to_...
true
98c00a6aac2f0986b5fa04b841209ee4fee6ac55
Ruby
thomashexton/sei31-classwork
/_warmups/ruby/wordy_calc.rb
UTF-8
1,134
4.03125
4
[]
no_license
class Calculator def initialize question @question = question matches end def matches @matches = @question.match( /(-?\d+) (plus|minus|divided by|multplied by) (-?\d+)/ ) end def first_number @matches[1].to_i end def operation case @matches[2] when "plus" then :+ when "minus" then :- when ...
true
bd05eb0aee8eba775844868ee35071f9d2aa6149
Ruby
NelsonCavalcante/meu-ifnmg
/app/class/facade.rb
UTF-8
554
2.625
3
[]
no_license
require "databridge.rb" # This class implements the facade design pattern class Facade # singleton design pattern implementation def self.getInstance @@instance ||= Facade.send :new end # mapping bridge Model's Class to local vars (alias) for FACADE fast access def Diaria @diaria...
true
ba192f844986571215c228a08e50aabc19124d6c
Ruby
markalanevans/angellist-api
/lib/angellist_api/client/follows.rb
UTF-8
5,681
2.6875
3
[ "MIT" ]
permissive
module AngellistApi class Client # Defines methods related to URLs # # @see http://angel.co/api/spec/follows module Follows # Makes the authenticated user follow the specified item. Returns the new # follow on success, or an error on failure. # # @requires_authentication Yes ...
true
b87bff7b94c9f48e1ce12f7fdc791272869dbe95
Ruby
ea2305/basicHuffman
/Main.rb
UTF-8
1,375
2.765625
3
[]
no_license
#author : Elihu Alejandro Cruz Albores #version 1.0.7 #Modulos necesarios load './struct/components/Node.rb' load './struct/components/AddTree.rb' load './struct/components/DrawTree.rb' load './struct/components/OrderTree.rb' load './struct/components/RemoveTree.rb' load './struct/components/SearchTree.rb' load './str...
true
8f99880c46532a63862150dad12bd46ff365045c
Ruby
dcoy/learning-ruby
/oop/inheritance.rb
UTF-8
1,136
3.25
3
[]
no_license
# OOP Inheritance in Ruby class APIConnector attr_accessor :title, :description, :url # When class is created, this method will run def initialize(title: title, description: description, url: url = "https://google.com") @title = title @description = description @url = url end def testing_initia...
true
f1ff79baf1b7ebeee8de3fd82678b4b67d9330d2
Ruby
pawurb/Siorbackend
/spec/models/user_spec.rb
UTF-8
2,928
2.578125
3
[]
no_license
require 'spec_helper' describe User do describe "structure" do it { should respond_to(:provider) } it { should respond_to(:uid) } it { should respond_to(:name) } it { should respond_to(:email) } it { should respond_to(:nickname) } it { should respond_to(:oauth_token) } it { should respond...
true
8ef60b9ba757f662cb7f3487aa53e5b9627b7650
Ruby
collabnix/dockerlabs
/vendor/bundle/ruby/2.6.0/gems/yell-2.2.2/lib/yell/level.rb
UTF-8
5,497
3.65625
4
[ "Apache-2.0", "MIT" ]
permissive
module Yell #:nodoc: # The +Level+ class handles the severities for you in order to determine # if an adapter should log or not. # # In order to setup your level, you have certain modifiers available: # at :warn # will be set to :warn level only # gt :warn # Will set from :error level onwards ...
true
fe1987c845fbb2ba573450be1e37878a1b870c7e
Ruby
smostovoy/word_generator
/generate.rb
UTF-8
596
2.53125
3
[]
no_license
# encoding: utf-8 search_pattern = ARGV[0] search_letters = search_pattern.split '' rules = { all_present: true, end_with: true } files = ['dic/ru.gnd', 'dic/ru_RU.dic'] files.each do |file| File.open file do |infile| while (line = infile.gets) dic_word = line.split(/[\s\/]/).first #p "/^#{"[...
true
bb2b7ccff48094acbebb6b5fd5ed07b8ee4c940f
Ruby
beechnut/homegrown
/controllers/branch_controller.rb
UTF-8
1,695
3.3125
3
[]
no_license
class BranchController include Processing::Proxy load '../models/branch.rb' def initialize @branches = [] end def add_branch(node1, node2, order=0) @branches << Branch.new(node1, node2, order) end def draw_branches(trunk_width, trunk_increment, contraction_ratio, gen) @branches.each do |branch| ...
true
256b384984bf7df4bdb67522387d99f2b76329d0
Ruby
DanFan1988/ReRails
/lib/rails_lite/session.rb
UTF-8
656
2.78125
3
[]
no_license
require 'json' require 'webrick' class Session # find the cookie for this app # deserialize the cookie into a hash def initialize(req) @req = req @req.cookies.each do |cookie| if cookie.name == "__rails_lite_app" p @monster = JSON.parse(cookie.value) else p @monster = Hash.ne...
true
1d013385bc721a534ce46cd96df46ad2d3f1413b
Ruby
petertseng/adventofcode-rb-2016
/16_dragon_checksum.rb
UTF-8
2,781
2.90625
3
[ "Apache-2.0" ]
permissive
test = ARGV.delete('-t') input = !ARGV.empty? && ARGV.first.match?(/^[01]+$/) ? ARGV.first : ARGF.read module Dragon module_function # parity of first n digits def parity(n) gray = n ^ (n >> 1) ((n & gray).to_s(2).count(?1) ^ gray) & 1 end # ones in the inclusive one-indexed range [left, right] ...
true
59ec0da6f693b5ced0e11ce5ac60ebda9f519de9
Ruby
dvdalilue/OhTeX
/lexer/lexer.rb
UTF-8
3,059
3.09375
3
[]
no_license
require_relative "classes" # $& # Depends on $~. The string matched by the last successful match. # $` # Depends on $~. The string to the left of the last successful match. # $' # Depends on $~. The string to the right of the last successful match. # $+ # Depends on $~. The highest group matched by the last succes...
true
eb500f391c0d84fda08dfcdca9e9171550bc1b57
Ruby
Dorani/Ruby_on_Rails_Lesson-Plans
/01-Ruby/02-Intermediate_Advanced/04-Crud_Users_Module(Part1).rb
UTF-8
1,188
3.765625
4
[]
no_license
require 'bcrypt' #users data: users = [ {username: "seif", password:"password1"}, {username: "dan", password:"password2"}, {username: "sam", password:"password3"}, {username: "stacy", password:"password4"}, {username: "carl", password:"password5"} ] #creation method def create_hash_digest(password) BCry...
true
f1ca79ea31b7ce097e3756082217b348f5855bb3
Ruby
Jmendoza173/programming-univbasics-3-labs-with-tdd-dumbo-web-071519
/calculator.rb
UTF-8
213
2.671875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# Add your variables here first_number=0 second_number=1 sum = first_number + second_number difference = first_number - second_number product = first_number * second_number quotient = first_number / second_number
true
fe552eed7eb344dc3f83d5c7700430a7a16f647d
Ruby
shivamsbansal/IMS_mysql_revision
/app/helpers/stations_helper.rb
UTF-8
1,170
2.578125
3
[]
no_license
module StationsHelper def user_access_stations(user) @user_access_stations ||= aux_user_access_stations(user) end def aux_user_access_stations(user) if user[:level_type]!= nil if user.admin? @stations = Station.all @name = "Central Team" elsif Region.find(user.level_id).nameRegion=="India" ...
true
a2262d9faee9c0c18a278e14cfb7e03f59917dcc
Ruby
vongk97/tictactoe_v2
/board.rb
UTF-8
620
4.34375
4
[]
no_license
class Board # class variable which represents cells on 3x3 grid @cells def initialize @cells = [1,2,3,4,5,6,7,8,9] end # each cell corresponds to an index in @@cells array. # User input will override default number values def show_board puts " #{@cells[0]} | #{@cells[1]} ...
true
721fa588f06f92811fc7403c40d0bff3c70aaf1e
Ruby
edlowther/bank_tech_test
/lib/statement.rb
UTF-8
591
3.015625
3
[]
no_license
class Statement def initialize(transactions) @transactions = transactions end def print result = "date || credit || debit || balance" @transactions.reverse.each do |transaction| result += "\n" result += transaction.date.strftime('%d/%m/%Y') + " || " if transaction.type == :deposit ...
true
bea7417928ccc70957bb5ccc2ca3c365311dfaac
Ruby
metzger243/TTS-PTCI
/ruby/add.rb
UTF-8
65
2.890625
3
[]
no_license
def add_it_up(num1, num2) num1 + num2 end puts add_it_up(1, 5)
true
afbf865db40a2ecff22c4b523091aa53c53d7e39
Ruby
modulexcite/volta
/build/common.rb
UTF-8
644
3.0625
3
[ "MIT" ]
permissive
require "fileutils" module Common def Common.EnsurePath(path) if !Dir.exists?(path) then FileUtils.mkdir_p(path) end end def Common.DeleteDirectory(path) if Dir.exists?(path) then FileUtils.rm_rf path end end def Common.CopyFiles(source, target) Dir.glob(source) do |name| ...
true
af83964f97b5bca30395ceba0bc17823dcffe299
Ruby
seiyakawa/furima-29307
/app/forms/order_address.rb
UTF-8
1,144
2.515625
3
[]
no_license
class OrderAddress include ActiveModel::Model # 指定した値をインスタンス変数として取り扱ってくれるメソッド attr_accessor :token, :post_code, :prefecture_id, :city, :address, :building, :phone_number, :user_id, :item_id # 空の投稿を保存できないように設定 with_options presence: true do validates :token # クレジットカードトークンバリデーション validates :post_code, ...
true
24b75264c307b9bbbe7454e4c52004bb7d8d5b31
Ruby
corneljr/bit_learn_ruby
/05_silly_blocks/silly_blocks.rb
UTF-8
161
3.3125
3
[]
no_license
def reverser word = yield word.split.each(&:reverse!).join(' ') end def adder(num = 1) yield + num end def repeater(num = 1) num.times do yield end end
true
6fa135476e997495f506270432cbb31cc3281c0b
Ruby
ferminhg/rubyonrails-training
/hackerrank/algorithms/grading-student.rb
UTF-8
310
3.40625
3
[]
no_license
#!/bin/ruby require 'json' require 'stringio' def grading_policy grade return grade if grade < 38 (grade % 5) >= 3 ? grade + (5 - (grade % 5)) : grade end def gradingStudents grades grades.map{ |grade| grading_policy grade} end grades = [73, 67, 38, 33] result = gradingStudents grades p result
true
2c2ba940745751d5e0028d3eb5c28cfbc2f21e24
Ruby
cielavenir/procon
/yukicoder/tyama_yukicoder841.rb
UTF-8
126
3.21875
3
[ "0BSD" ]
permissive
#!/usr/bin/ruby a,b=gets.split if a!='Sat'&&a!='Sun' puts '8/31' elsif b!='Sat'&&b!='Sun' puts '8/32' else puts '8/33' end
true
0d575433fc419e88a679e0bc53dc164e28c7dacc
Ruby
nthj/bluemoon
/lib/bluemoon/bluetooth.rb
UTF-8
263
2.53125
3
[ "MIT" ]
permissive
module Bluemoon class Bluetooth def self.off power(0) end def self.on power(1) end def self.power(flag) unless `blueutil power`.to_i == flag.to_i `blueutil power #{flag}` true end end end end
true
5f833c5ea45351dd27247be42c262f5f6aa40b14
Ruby
andresgutgon/marketo
/helpers/email_helpers.rb
UTF-8
2,059
2.546875
3
[]
no_license
module EmailHelpers PROPERTIES = { :email_width => 600, :email_padding => 30, :email_width_mobile => 330, :email_padding_mobile => 15 } def get_email_property(property=nil) raise 'No property defined' unless PROPERTIES.keys.include? property PROPERTIES[property] end # This value mus...
true
81c82a6159c5130aaabb8c4febe300d8dc555cab
Ruby
yoshig/maze_solver
/maze_solver.rb
UTF-8
2,783
3.671875
4
[]
no_license
class MazeSolver def initialize(diagonals_allowed = true) @maze = self.class.create_map @open_squares = self.list_all_opens @ending = find_ending @beginning = find_beginning @diagonals_allowed = diagonals_allowed end def self.create_map if ARGV.empty? maze = File.readlines('maze1...
true
1ff8954ef0d9a26c30b6b2d1287bfc89991470a2
Ruby
HazumuDev/learn-ruby
/class_method_def2.rb
UTF-8
389
3.71875
4
[]
no_license
puts "---class method def---" class Hoge def Hoge.foo puts "This is foo" end end def Hoge.bar end class Hoge def self.baz puts "This is baz" end end class << Hoge def bar puts "This is bar" end end module Foo def foo puts "This is module Foo.foo" end end ...
true
3d853bed6b6cd214f775b850e4b0afdf443b4ea4
Ruby
sevperez/yalp
/yalp/app/models/review.rb
UTF-8
1,307
2.84375
3
[]
no_license
class Review < ActiveRecord::Base REVIEWS_PER_PAGE = 10 validates :stars, presence: { message: "A star rating is required." }, inclusion: { in: 1..5, message: "Star rating must be between 1 and 5." } validates :content, length: { maximum: 2000, message: "Review content must be less than 2000 characters in leng...
true
a30efce09a889352bf718d24323064a431323df9
Ruby
PagerDuty/pd-bizops-aether
/lib/aether/types.rb
UTF-8
3,469
2.796875
3
[ "MIT" ]
permissive
require 'date' module Aether module SFTypes MAX_CHARACTERVARYING_SIZE = 65535 class SFDouble attr_reader :precision, :scale def initialize(precision:, scale:) @precision = precision @scale = scale end def to_rs_type ::Aether::RSTypes::Numeric.new(precision: ...
true
26038d9fd23927ea3e9a8196dcadbf6473ebb3c3
Ruby
aruprakshit/evidence_doc
/lib/evidence_doc/spread_sheet.rb
UTF-8
684
2.5625
3
[ "MIT" ]
permissive
require 'rubyXL' module EvidenceDoc class SpreadSheet HGVS_VELL_CELL = 12 CAID_CELL = 13 MAF_CELL = 14 CLIN_VAR_URL_CELL = 15 def initialize path_to_file @workbook = RubyXL::Parser.parse(path_to_file) end def write_to_cell row, col, val worksheet.add_cell...
true
0578a2e85591a3ae38af14615cf23e95a63badc2
Ruby
melindaweathers/advent2020
/day14/day14.rb
UTF-8
1,478
3.265625
3
[]
no_license
class DockingProgram def initialize(filename) @filename = filename @mask = 0 @mem = {} end def run_program IO.readlines(@filename).each do |line| target, val = line.split(' = ') if target == 'mask' @ones_mask = val.gsub('X','0').to_i(2) @zeros_mask = val.gsub('X','1')....
true
8f9942fb8aa74f39529d69b04329e1f18b78c799
Ruby
SakhiStuti/hw-acceptance-unit-test-cycle
/rottenpotatoes/app/models/movie.rb
UTF-8
313
2.546875
3
[]
no_license
class Movie < ActiveRecord::Base def self.all_ratings %w(G PG PG-13 NC-17 R) end def self.same_director title1 @movie=Movie.find_by_title(title1) dirt=@movie.director if dirt.nil? || dirt == "" return nil else Movie.where(director: dirt).pluck(:title) end end end
true
1d6245c9ce99fae56aa4865eda308a414b36152a
Ruby
irosenb/Credit-Card
/lib/credit_card.rb
UTF-8
364
2.9375
3
[ "MIT" ]
permissive
module Isaac class CreditCard attr_accessor :balance attr_reader :number, :limit attr_reader :valid def initialize(card_number, limit) @number = card_number @limit = limit @balance = 0 @valid = Luhn.new(@number).valid? end def balance=(value) @balance = value if...
true
4c31f55ec416c9f0d3ee279662fcfff5e3aeefe1
Ruby
jweissman/functionalism
/lib/functionalism/first.rb
UTF-8
530
3.078125
3
[ "MIT" ]
permissive
module Functionalism First = lambda do |collection| collection = collection.chars if collection.is_a?(String) collection.first end Head = First Rest = lambda do |collection| collection = collection.chars if collection.is_a?(String) if collection.is_a?(Enumerator) collection.lazy.drop(1) ...
true
8ed557760e9c80cf050c6e1edb11d6a180d6c3f0
Ruby
santosral/ruby_on_rails_projects
/coding_exercises/iq_test.rb
UTF-8
1,241
4.59375
5
[]
no_license
# frozen_string_literal: true # Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given numbers # differs from the others. Bob observed that one number usually differs from the others in evenness. # Help Bob to check his answers, he needs a program that among the giv...
true
299cd7b25cdf45ccee5982563c569366a4555726
Ruby
zestyzesty/time_period
/lib/time_period/month.rb
UTF-8
188
2.546875
3
[ "MIT" ]
permissive
require_relative "./base" module TimePeriod class Month < Base DURATION = 1.month def initialize(beginning) super(beginning.to_date.beginning_of_month) end end end
true
8be779cc24031df644e9d7ae9fc4458d911aabbf
Ruby
akhardya/Exercices
/katas/ruby/fizzbuzz.rb
UTF-8
120
3.46875
3
[]
no_license
#!usr/bin/ruby def fizzbuzz(number) if number == 2 return "2" end if number == 1 return "1" end end
true
5fb9c1bbb682209887cc599e97b9271f4d6edae2
Ruby
stephwilhelm/rspec-fizzbuzz-online-web-sp-000
/OriginalPassed.rb
UTF-8
350
3.6875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def fizzbuzz(int) if int % 3 == fizz_3 puts "Fizz" elsif int % 5 == fizz_5 puts "Buzz" elsif int % 3 && int % 5 == fizz_15 puts "FizzBuzz" else int % 4 == nil puts "Nil" # There should be an end here. If you don't put the end it passes the test. Looks like as long as you define fizzbuzz you...
true
bab3a03155114fa13e1ecc8adabd2ff84a8245d0
Ruby
rwparrish/ruby-object-attributes-lab-onl01-seng-ft-032320
/lib/person.rb
UTF-8
218
3
3
[]
no_license
class Person def name=(first) @name = first end def name @name end def job=(career) @job = career end def job @job end end beyonce = Person.new beyonce.name = "Beyonce"
true
02d94ca311f8d5eb74c2461647956793c83b5e11
Ruby
linkenneth/project-euler
/37/37.rb
UTF-8
619
3.46875
3
[]
no_license
require 'prime' require 'set' truncatables = Set.new sieve = Prime::EratosthenesGenerator.new primes = Set.new while truncatables.length < 11 do prime = sieve.next.to_s primes << prime next if prime.length <= 1 isTruncatable = true # ltr prime.length.times do |i| if not primes.include? prime[i, pri...
true
b436d432cfa2e1511f3abc55e7732a8874eb63e5
Ruby
aridlehoover/inside-out-presentation
/application_centric/app/readers/twa_reader.rb
UTF-8
503
2.78125
3
[]
no_license
require_relative '../../../lib/twitter' class TWAReader < Reader ONE_HOUR = 3600 def read Twitter.get_tweets(url).map { |item| parse(item) } end private def parse(item) title, desc = item.body.match(/^([^.]*)\.(.*)/).captures { id: item.id, title: title, description: desc, ...
true
42c52567c38a1fdeb6fa065f9b812e61fadc7b11
Ruby
hechen0/Ruby-leetcode
/solutions/53-maximum-subarray.rb
UTF-8
280
3.421875
3
[ "MIT" ]
permissive
# @param {Integer[]} nums # @return {Integer} def max_sub_array(nums) max = 0 nums.each_index do |i| next if i == 0 nums[i] = [nums[i], nums[i] + nums[i-1]].max end nums.max end p max_sub_array([-2,1,-3,4,-1,2,1,-5,4]) p max_sub_array([-2, 1])
true
fd2ccd754950c9ff8bc00ff9a4da8958a257cf92
Ruby
dlangsam/Ironhack
/Week2/todo/spec/task_spec.rb
UTF-8
1,357
2.96875
3
[]
no_license
require_relative("../lib/task.rb") RSpec.describe do "Task Tests" before :each do @task = Task.new("fold laundry") end describe "#complete? test" do it "checks whether a newly created test is not complete" do expect( @task.complete?).to eq(false) end end describe "#complete! test" ...
true
9724cdf8fec77dcc127833d91c6f9d3d0e14b234
Ruby
markyv18/battleship
/test/battleship_test.rb
UTF-8
857
2.96875
3
[]
no_license
gem 'minitest', '~> 5.2' require 'minitest/autorun' require 'minitest/pride' require './lib/battleship.rb' class BattleshipTest < Minitest::Test def test_prints_welcome # skip ship = Battleship.new assert_equal " Welcome to BATTLESHIP", ship.welcome end def test_bad_input # skip shi...
true
cc7706fed5afe73dfe3c8a0ddf51caf36b254db5
Ruby
obazoud/flapjack
/lib/flapjack/filters/delays.rb
UTF-8
3,755
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'flapjack/data/entity_check' require 'flapjack/filters/base' module Flapjack module Filters # * If the service event’s state is a failure, and the time since the last state change # is below a threshold (e.g. 30 seconds), then don't alert # * If the service event’s state i...
true
38d67750b22864a8081094a82636f167d5883ed7
Ruby
shokai/rtbot
/helpers/html.rb
UTF-8
214
2.859375
3
[]
no_license
class String def markup_html self.gsub(/(https?:\/\/[^\s]+)/){"<a href=\"#{$1}\">#{$1}</a>" } end end if __FILE__ == $0 puts s = "hello this site is cool http://shokai.org thx." puts s.markup_html end
true
f7cf1d0ebb68b06b35970e61ebace3088395d271
Ruby
kscotteng/ToDoList
/todo_list.rb
UTF-8
2,557
4.28125
4
[]
no_license
# Simple To Do List # require access to todo_item.rb file require "./todo_item.rb" class ToDoList attr_reader :name, :todo_items def initialize(name) @name = name @todo_items = [] end #add method that appends TodoItems to ToDoList def add_item(name) todo_items << (ToDoItem.new(name)) end #...
true
9188cb15129400615faad85c6884df53560afad2
Ruby
h2o/h2o
/deps/mruby/mrblib/string.rb
UTF-8
4,448
3.40625
3
[ "MIT" ]
permissive
## # String # # ISO 15.2.10 class String # ISO 15.2.10.3 include Comparable ## # Calls the given block for each line # and pass the respective line. # # ISO 15.2.10.5.15 def each_line(separator = "\n", &block) return to_enum(:each_line, separator) unless block if separator.nil? block.cal...
true
77d19d457ec9c473dfa046b7a6f38f4dfa040aa7
Ruby
alessandral/axlsx_examples
/lib/alignment_cells.rb
UTF-8
977
2.546875
3
[]
no_license
require 'axlsx' require 'pry' if __FILE__ == $0 puts "Pattern fill" p = Axlsx::Package.new p.workbook do |w| title = w.styles.add_style(:bg_color => "333399", :fg_color=>"FFFFFF", :sz=>14, :border=> {:style => :thin, :color => "000000"}, :alignment => {:horizontal => :center}) cell_alignment = w.styl...
true
657d22d90650ca9295a8804ae6f213085a09099f
Ruby
johne-numata/ruby_DL
/trainer.rb
SHIFT_JIS
3,031
2.84375
3
[]
no_license
require 'numo/narray' require './optimizers' class Trainer # j[lbǧPsNX attr_reader :train_acc_list, :test_acc_list def initialize(network: , x_train: , t_train: , x_test: , t_test:, epochs: 20, mini_batch_size: 100, optimizer: 'SGD', optimizer_param: {'lr':0.01}, ...
true
e5d5540f166531c24533ddbafbace2c896642cc9
Ruby
beaucouplus/launchschool_oop
/oop_book/my_car.rb
UTF-8
926
3.09375
3
[]
no_license
require_relative 'vehicle' require_relative 'arrestable' class MyCar < Vehicle include Arrestable DIFFERENCE = "4 wheels and tiny size" attr_reader :model def self.difference DIFFERENCE end def initialize(year, color, model) super end def to_s "My car" + super end end class MyTruck...
true
65e01653723c6880deafcd622b65142ac7d3ffa0
Ruby
faithalynelong/intro-software-engineering-movie-arrays
/spec/movies_spec.rb
UTF-8
1,264
3.125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'spec_helper.rb' describe 'movies' do before(:each) do @movies = ["Minions", "Trainwreck", "Inside Out", "Silver Linings Playbook", "Pitch Perfect 2", "Hot Pursuit" ] end describe '#first_movie' do it "returns a the first movie" do expect(first_movie(@movies)).to eq("Minions") end ...
true
0e4ffd3c6e47c5c0dd9a3006ad73084d09723c79
Ruby
joxer/traybar-energy
/icon-name.rb
UTF-8
912
2.84375
3
[]
no_license
require 'ACPI' include ACPI module IconName class GetIcon def initialize @icons = {"0"=>"battery-25.svg", "1"=>"battery-50.svg", "2"=>"battery-75.svg", "3"=>"battery-full.svg", "4"=>"battery-full.svg", "low"=>"battery-low-png.svg", "alert"=>"battery-emptyalert0.svg", "nostatus"=>"ba...
true
93754772aa1e92afd7c78157a365e083d9b3bd60
Ruby
swapnilp/era_cord
/app/models/api_rpm_store.rb
UTF-8
594
2.53125
3
[]
no_license
class ApiRpmStore TIME_TO_EXPIRE = 1.minute # 1 min class << self attr_accessor :redis_client def init(config = {}) self.redis_client = $redis #Redis.new(:url => "redis://#{config['host']}:#{config['port']}/#{config['database']}") end def incr(key) #val = redis_client.incr(key) ...
true
bb7ebb54c84be3e2e6ef3a8fab0e271b9e96b436
Ruby
cloudaper/liqaml
/lib/liqaml.rb
UTF-8
3,321
2.828125
3
[]
no_license
require 'liqaml/version' require 'message_format' require 'liquid' require 'json' module Liqaml class LiqamlError < StandardError; end class Liqaml # Raises SyntaxError when invalid Liquid syntax is used Liquid::Template.error_mode = :strict def initialize(locales_array, tokens_array, yaml_target, js...
true
5815a2de4116312b25132d81a08a77477770da0c
Ruby
misterpk/Introduction-to-Programming-with-Ruby
/05_loops_iterators/exercise_2.rb
UTF-8
126
3.203125
3
[]
no_license
while true puts "Enter some text:" user_input = gets.chomp if user_input == "STOP" exit(0) else next end end
true
702eef35bb1c842c82e7929136aa14fc99b5e756
Ruby
VikramChilkunda/tutormatching
/path/ruby/2.6.0/gems/nokogiri-1.1.0/lib/nokogiri/xml/reader.rb
UTF-8
219
2.53125
3
[ "MIT" ]
permissive
module Nokogiri module XML class Reader include Enumerable def each(&block) while node = self.read block.call(node) end end private :initialize end end end
true
80cdfb8e085a5b1e7d13548a4205d18834233f3d
Ruby
tenderlove/kedama
/lib/kedama/swf/gradient.rb
UTF-8
1,029
2.8125
3
[ "MIT" ]
permissive
module Kedama module SWF class Gradient def initialize yield self if block_given? end ### # Add a control point. Ratio defines the position of the control point. # # Example: # gradient.add_entry(:ratio => 1, :r => 0xff, :g => 0, :b => 0, :a => 0) # gr...
true
9f85bd3869cfdc72be63f78ff06793451e64b63a
Ruby
tennin/leaern_to_program
/99_bottles_B.rb
UTF-8
1,036
4.40625
4
[]
no_license
def bottle_lyrics number my_string = '' count = number while count>0 puts count.to_s + ' bottles of beer on the wall,' + count.to_s + ' bottles of beer' if count == 1 puts 'Take one down and pass it around, no more bottles of beer on the wall.' puts 'Go to the store and buy some more, ' + number.to_s + ' bot...
true
4fbf950855d165aa110c6c8db803c906d7b6574d
Ruby
zhagnx/ruby_study
/script/20150614/uniq_and_sort_file.rb
UTF-8
255
2.765625
3
[]
no_license
#!/usr/bin/env ruby # sort and uniq a file file_array = File.readlines(ARGV[0]).uniq.sort file_basename = File.basename(ARGV[0]) File.open("./result/sorted_uniq_#{file_basename}", 'w') do |fh| file_array.each do |line| fh.write(line) end end
true
1bf696857408f91f6ad7c01b5c07c90f3f4c0920
Ruby
jedipunkz/awscale
/lib/http.rb
UTF-8
490
2.578125
3
[]
no_license
#!/usr/bin/env ruby require 'httpclient' def http_check_status(url) begin client = HTTPClient.new client.receive_timeout = 1000 status = client.get(url).status if status == 200 then return true else return false end rescue HTTPClient::KeepAliveDisconnected @error = "KeepAli...
true
c1a0ac510c4ab15001c255b1496f28f839294f05
Ruby
AlejandroDeheza/TADP-TP
/ruby/lib/Util.rb
UTF-8
375
3.109375
3
[]
no_license
module Util private def sin_find_by_(mensaje) mensaje.to_s.gsub("find_by_", "").to_sym end def es_tipo_primitivo(clase) clase <= String || clase <= Numeric || clase <= Boolean end def pasar_a_setter(simbolo) (simbolo.to_s << "=").to_sym end end module Boolean end class TrueClass inclu...
true
820aa574160394b144abafde5b93411d36d77e61
Ruby
useruby/bitmap_editor
/spec/lib/bitmap_editor/interpreter_spec.rb
UTF-8
447
2.609375
3
[]
no_license
require 'minitest/autorun' require 'bitmap_editor/interpreter' describe BitmapEditor::Interpreter do let(:script) { "I 5 6\nL 1 3 A\nV 2 3 6 W\nH 3 5 2 Z\n-F 4 4 X\nS" } subject { BitmapEditor::Interpreter.new(script) } describe '#parse' do it 'returns list of the commands' do assert(subject.parse.i...
true
74c2bc4665d3c7da8779d571ae1a4eb0fe9ea36a
Ruby
krud/ruby-enumerables-hash-practice-nyc-pigeon-organizer-lab-denver-web-111819
/nyc_pigeon_organizer.rb
UTF-8
362
2.78125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def nyc_pigeon_organizer(data) # write your code here! result = {} data.collect {|key, value| value.collect{|key2, value2| value2.collect{|name| if result[name] == nil result[name] = {} end if result[name][key] == nil result[name][key] = [] end result[name][key]....
true
6e61dfc70fb8a2097ee8d10e48187e70dffc0784
Ruby
Edgar-Cortez/AppAcademyOpen
/01-Intro to Programming/07-AdvancedProblems/Assignment/09-PickPrimes.rb
UTF-8
1,266
5.0625
5
[]
no_license
# Write a method pick_primes that takes in an array of numbers # and returns a new array containing only the prime numbers. # ---------- Steps ---------- # - create helper method to check if number given is a prime # - in pick_primes: create an empty array # - iterate through given array and call the helper method ...
true
d8c4b1c08b95797f386927e6f21224a62ffcd36f
Ruby
azuki1968/ruby-exercise
/testunit_1.rb
UTF-8
1,149
3.46875
3
[]
no_license
#!usr/bin/ruby require 'test/unit' #この記述をすることでTest::Unit::TestCaseが実行される class Sample #Sampleクラスにクラスメソッドを定義 def self.greeting 'Hello, world' end def self.greeting2 'Hello, world2' end end class Sample2 #Sample2クラスにクラスメソッドを定義 def self.greeting3 'Hello, world3' ...
true