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
7ea9e06a2610dc34aa7b9da2a4454a029ce1b464
Ruby
zacsek/paradoxical
/lib/paradoxical/parser.rb
UTF-8
1,306
2.890625
3
[ "MIT" ]
permissive
require 'singleton' require 'citrus' require 'yaml' require 'date' class Hash alias_method :old_at, :[] alias_method :old_at_eq, :[]= def [](key) if key.is_a?(String) && key.start_with?('xp:') begin key = key.gsub('xp:','') path = key.split('/').map { |p| p.to_sym } hash = self path.each { |p|...
true
fe17917f1b105215b906db51b18d92eebc805f85
Ruby
seomoz/moz_nav
/spec/support/in_sub_process.rb
UTF-8
287
2.609375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module InSubProcess def in_sub_process readme, writeme = IO.pipe pid = Process.fork do readme.close writeme.write yield writeme.close end writeme.close Process.waitpid(pid) return_val = readme.read readme.close return_val end end
true
7a6559a339035bb2a0cd725821d5a538edb24878
Ruby
NicolasJJensen/Terminal-RPG
/Testing/game_object_test.rb
UTF-8
1,584
2.984375
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'test/unit' require_relative '../Core/vector' require_relative '../Core/raw_graphic' require_relative '../Core/sprite' require_relative '../Core/animation' require_relative '../Core/game_object' # Tests for the Game class class GameObjectTest < Test::Unit::TestCase def setup ...
true
f10b2f5be8094c9ce029c7ae853b544e393a07ac
Ruby
zines-archive/zines
/uninformed/code.2.2/tra/opcodes.rb
UTF-8
13,854
2.703125
3
[]
no_license
### # # Opcodes # ------- # # This module wraps the all the opcodes in the opcode database. # ### module Opcodes def self.opcode_groups opcode_hash end def self.opcode_groups_ary groups = {} opcode_hash.each_pair { |o, g| groups[g] = 1 } groups.keys.sort end def self.opcodes opcode_hash.keys e...
true
d21e78b4c8626e3c69c53e40e5a0eebc025d3b49
Ruby
Duosmium/sciolyff-conversions
/csv2sciolyff.rb
UTF-8
2,068
3.09375
3
[]
no_license
#!/usr/bin/env ruby # frozen_string_literal: true # Kinda converts a specific CSV format to SciolyFF # The sections Tournament and Penalties still need to be added manually # require 'csv' require 'yaml' if ARGV.empty? puts 'needs a file to convert' exit 1 end csv = CSV.read(ARGV.first) events = csv.first.drop(...
true
1e8e15e4c802429076ff63861188b18e87a82bb4
Ruby
bubbadog/ruby_book
/loops/loops_exercises.rb
UTF-8
663
4.4375
4
[]
no_license
# 1. Each always returns the original array =begin x = [1, 2, 3, 4, 5] x.each do |a| puts a + 1 end =end # 2. =begin stop = '' while stop != "STOP" puts "Please give me a number: " answer = gets.chomp.to_i puts (answer * 2) puts "Want me to ask you again?" stop = gets.chomp.upcase end =end # 3. =begin family_n...
true
359331ea8572ea80817e707ca0fb7118e0cc72fc
Ruby
topromulan/ghpalacewalls
/GHPW/quick3d.rb
UTF-8
228
2.75
3
[]
no_license
i = File.new("3dcoorddata", "r") #4 nums per line #ex. #2508 3 2 0 re = /([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)/ while l=i.readline re.match(l) puts "goto #{$1}; edit name ( #{$2}. #{$3}. #{$4} )" end
true
3a6ce9962a8076306c04df1fed84d97f583d58b6
Ruby
TomoMayumi/contest
/atcoder/abc242/a.rb
UTF-8
108
2.796875
3
[]
no_license
a,b,c,x=gets.split.map(&:to_i) case when x<=a p 1 when x<=b p c*1.0/(b-a) else p 0 end
true
5c5e83d0c9f0656b0f710e5afb81c8862d8af606
Ruby
ClaudioFloreani/countries
/lib/countries/country/class_methods.rb
UTF-8
5,361
2.75
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'unicode_utils/downcase' require 'sixarm_ruby_unaccent' module ISO3166 UNSEARCHABLE_METHODS = [:translations].freeze def self::Country(country_data_or_country) case country_data_or_country when ISO3166::Country country_data_or_country when String, Symbol ISO3166::Country.search(cou...
true
693960732a4cc1c4cc93c88774ffb3f9d1dac61d
Ruby
nicholaslemay/AdventOfCode2017
/Day8/registers.rb
UTF-8
770
3.015625
3
[]
no_license
class Registers @@registers = Hash.new(0) @@max_ever = 0 def self.process(instructions) instructions.each do |line| target, operation, value, source, comparator, comparison = parse(line) if @@registers[source].send(comparator, comparison.to_i) self.send(operation,target,value.to_i...
true
2cfbbc162366836b88887548fde11c829c4323be
Ruby
bgrogg/w2d3
/tdd/spec/tdd_exercises_spec.rb
UTF-8
1,536
3.515625
4
[]
no_license
require 'rspec' require 'tdd_exercises' describe "#my_uniq" do let(:array) { [1, 2, 1, 3, 3] } it "return an array" do expect(array.my_uniq).to be_a(Array) end it "it does not modify the original array" do expect(array.my_uniq).to_not be(array) end it "contains only unique elements" do expec...
true
fc29c9ecaf0a3b035f949a3a86179ac6a08c6929
Ruby
miroosama/countdown-to-midnight-web-010818
/countdown.rb
UTF-8
158
3.25
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#write your code here def countdown(num) counter = num while num > 0 puts "#{num} SECONDS!" counter -= 1 end return "HAPPY NEW YEAR!" end end
true
29e345c93d212fe0f03dc059f90c226c83036778
Ruby
randallreedjr/project-euler
/009-special-pythagorean/special_pythagorean.rb
UTF-8
648
3.703125
4
[]
no_license
require 'pry' class SpecialPythagorean def initialize(sum) @sum = sum end def calculate (1..@sum-3).to_a.permutation(2).each do |double| if (double[0] < double[1]) && perfect_square?(double.map{|i| i**2}.inject(&:+)) triple = double + [Math.sqrt(double.map{|i| i**2}.inject(&:+))] if...
true
a1a5b90e58fde9d50cb03030885fb30be929da2c
Ruby
mehmetgul/LearnRuby
/ExponentMehods.rb
UTF-8
277
3.34375
3
[]
no_license
def pow(base_num, pow_num) result = 1 pow_num.times do |index| result = result * base_num end return result end puts pow(2, 3) def pow1(base_num, pow_num) result = 1 pow_num.times do result = result * base_num end return result end puts pow1(12, 3)
true
522b7ba143674c833539b63804af2eeac80a1e3e
Ruby
DianaE620/Lee_Error
/lee_error.rb
UTF-8
1,129
3.84375
4
[]
no_license
def dummy_encrypt(string) string.reverse.swapcase.gsub(/[aeiou]/, "*") end puts dummy_encrypt("EsteEsMiPassword") == "DROWSSApImS*ETS*" def max_letter_frequency_per_word(sentence) enunciado = sentence.split enunciado = words_longer_than(enunciado, 3) frecuencias = letter_per_word(enunciado, "e") num...
true
4d82170e9d4ccd410401dc45bc6792203e405f40
Ruby
jeanlazarou/swiby
/core/test/manual/combo_test.rb
UTF-8
1,106
2.984375
3
[ "CC-BY-2.5", "BSD-3-Clause" ]
permissive
#-- # Copyright (C) Swiby Committers. All rights reserved. # # The software in this package is published under the terms of the BSD # style license a copy of which has been included with this distribution in # the LICENSE.txt file. # #++ class ComboTest < ManualTest manual 'Combo w/ strings, handler receives s...
true
cd43a22080911e849228cae92cea86cf31ba08f5
Ruby
ninamutty/MediaRanker
/test/models/seinfeld_test.rb
UTF-8
1,191
2.75
3
[]
no_license
require 'test_helper' class SeinfeldTest < ActiveSupport::TestCase # test "the truth" do # assert true # end test "Seinfeld Episodes must have a title, season, episode and rank" do assert seinfelds(:peephole).valid? "The Reverse Peephole should be valid" seinfelds(:peephole).title = nil ## This nam...
true
5ae51990cffecc2458e5f06ffeabfcb26e957626
Ruby
Alochner2/com-531-ruby
/ch.14.rb
UTF-8
853
3.734375
4
[]
no_license
toast = Proc.new do puts 'Cheers!' end toast.call toast.call toast.call do_you_like = Proc.new do |good_stuff| puts "I *really* like #{good_stuff}!" end do_you_like.call 'chocolate' do_you_like.call 'Ruby' def maybe_do some_proc if rand(2) == 0 some_proc.call end end def twice_do some_proc some_proc....
true
081f8114ad1ae978bfb6be6ee7878bb2f9299f1a
Ruby
Kukmedis/ruby-task
/table.rb
UTF-8
380
2.71875
3
[]
no_license
require '~/ruby/turn' class Table attr_accessor :seats, :players, :smallBlind, :quota, :bigBlind, :lastDealer, :turn def initialize(seats, smallBlind) @seats = seats @smallBlind = smallBlind @bigBlind = smallBlind * 2 @quota = smallBlind * 100 @players = [] @lastDealer = nil end d...
true
178cdb224737a662c0051c4f461bd491c9d59674
Ruby
danmoran-pro/flash_cards
/lib/flashcard_runner.rb
UTF-8
264
2.921875
3
[]
no_license
require './lib/card' require './lib/turn' require './lib/deck' require './lib/round' class Flashcard_runner def initialize(argument) @argument = argument end @round = Round.new(@deck) puts Welcome! You're playing with 5 cards. puts "-" * 50 end
true
478f170e05aecd228abaa68479bb8a02e8bad489
Ruby
borgr/l---l
/blank_Quantifier.rb
UTF-8
509
2.953125
3
[]
no_license
require 'treat' include Treat::Core::DSL require_relative 'HelpQuestions' par = get_document #create a blank over a number =begin still quite naive. should enhancing it with names and places be smart, or should they be different functions? =end par.each_sentence do |sent| number = tagged(sent, ["QP", "CD"], [], t...
true
c376420d38e3e73ec4201b926cef1ebda24f9666
Ruby
RazvanCiuca/ActiveRecordLite
/new_attr_accessor.rb
UTF-8
506
3.703125
4
[]
no_license
class Cat def self.new_attr_accessor(*attrs) attrs.each do |attr| #make a getter define_method(attr) do self.instance_variable_get("@#{attr}") end #make a setter define_method("#{attr}=") do |value| self.instance_variable_set("@#{attr}", value) end end ...
true
cdbc97d70877cb5499a2c6adb2b99d3083d13e06
Ruby
dburt/ankiverse
/ankiverse.rb
UTF-8
3,153
2.546875
3
[]
no_license
#!/usr/bin/ruby -w require 'rubygems' require 'nokogiri' require 'sinatra' require 'yaml' require RUBY_VERSION < '1.9' ? 'fastercsv' : 'csv' CSV = FasterCSV if not defined? CSV require './anki_card_generator' require './esv_api_request' require './sentence_splitter' class AnkiVerse < Sinatra::Base SUGGESTED_PASS...
true
bb2f8662ee16d7b30d110c153d815138e985adaf
Ruby
tomejesus/courier-kata
/app.rb
UTF-8
983
3.03125
3
[]
no_license
require './lib/controller.rb' class CourierBot < Controller def add_ten 3.times { new_parcel(9, 8, 7, 0.5) } 2.times { new_parcel(49, 38, 27, 5) } 2.times { new_parcel(99, 88, 77, 5) } 1.times { new_parcel(209, 108, 97, 5) } 1.times { new_parcel(9, 8, 7, 51) } 1.times { new_parcel(49, 38, 27,...
true
a65826ce30c0d48262711f75f2401bd9449bfd93
Ruby
pocke/gry
/lib/gry/formatter.rb
UTF-8
1,266
2.703125
3
[ "Apache-2.0" ]
permissive
module Gry class Formatter def initialize(display_disabled_cops:) @display_disabled_cops = display_disabled_cops end # @param gry_result [Array<Law>] # @return [String] a yaml string def format(laws) confs = laws.map do |law| if law.letter letter = {law.name => law.l...
true
2805a0dba6d6adcd88974d6243a3e19ffeaa9b0e
Ruby
JakobErlandsson/AdventofCode
/2019/helper.rb
UTF-8
191
3.125
3
[]
no_license
def readFile(filename) lines = [] text=File.open(filename).read text.each_line do |line| line.gsub!(/(\n*)$/, '') lines.push(line) end return lines end
true
e9bb4cf9850066a34c436727590ff0bad90eb8ef
Ruby
d3slife/beginner_ruby_projects
/stock_picker.rb
UTF-8
479
4.03125
4
[]
no_license
def stock_picker(array) length = array.length odds = 0 buy_day = 0 sell_day = 0 length.times do |step| buy = array[step] (length - step - 1).times do |inner_step| sell = array[inner_step + step + 1] if (odds < sell - buy) odds = sell - buy buy_day = step sell_day = inner_step +...
true
7d7dd5bb03fe041cbde569eca1a6769e9b43b0a5
Ruby
icecoll/leetcode
/remove-duplicates-from-sorted-list/app.rb
UTF-8
1,184
3.765625
4
[]
no_license
# Definition for singly-linked list. # class ListNode # attr_accessor :val, :next # def initialize(val = 0, _next = nil) # @val = val # @next = _next # end # end # @param {ListNode} head # @return {ListNode} def delete_duplicates(head) list = SinglyLinkedList.new(head) list.remove_duplic...
true
c6e59fc8b20492497edb403897c743afee27b3da
Ruby
happyFish/tvdb
/lib/tvdb/client.rb
UTF-8
1,851
2.609375
3
[ "MIT" ]
permissive
module TVdb class Client attr_reader :api_key, :urls def initialize(api_key) @api_key = api_key @urls = Urls.new(api_key) end def search(name, options={}) default_options = {:lang => 'en', :match_mode => :all} options = default_options.merge(options) sear...
true
9f0bd10e21fb6c7f4ee3599b7546debb6f6bf5db
Ruby
rubycdp/ferrum
/lib/ferrum/page/stream.rb
UTF-8
1,032
2.515625
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Ferrum class Page module Stream STREAM_CHUNK = 128 * 1024 def stream_to(path:, encoding:, handle:) if path.nil? stream_to_memory(encoding: encoding, handle: handle) else stream_to_file(path: path, handle: handle) end ...
true
f9668da31c02da2383dbb8d75ad37f33c5f2b0d3
Ruby
queria/scripts
/update_repos.rb
UTF-8
4,865
2.6875
3
[]
no_license
#!/usr/bin/env ruby require 'yaml' require 'pathname' require 'fileutils' def help puts <<HELP $ update_repos.rb [path_to_config_file] Config file has to be YAML file with at least source_path, target_path and git_baseurl. If no path_to_config_file is specified, './update_repos.yml' placed next to this script ...
true
b970e7effbfed5cd9a1ef0def629a8e3516c93b7
Ruby
seanchavez/swe_foundations
/rspec_exercise_5/lib/exercise.rb
UTF-8
1,243
3.5625
4
[]
no_license
require_relative "../../rspec_exercise_4/lib/part_1.rb" def zip(*arrs) zipped = [] arrs.first.length.times do |i| zipped[i] = [] arrs.each {|arr| zipped[i] << arr[i]} end zipped end def prizz_proc(arr, prc_1, prc_2) xor_select(arr, prc_1, prc_2) end def zany_zip(*arrs) zipped = [] arrs.max {|a,...
true
cb1d1e35236ee24558de637c1c1474dcaec736cb
Ruby
javierhonduco/server_timing_middleware
/lib/server_timing_middleware.rb
UTF-8
1,574
2.65625
3
[ "MIT" ]
permissive
# This simple Rack middleware subscribes to all AS::Notifications # and adds the appropriate `Server-Timing` header as described in # the spec [1] with the notifications grouped by name and with the # elapsed time added up. # # [1] Server Timing spec: https://w3c.github.io/server-timing/ module Rack class ServerTimi...
true
c45b29c3eb839ec9bce4cb880edac941b6055e7e
Ruby
kolba8/Ruby-introduction
/ruby-introduction/multiplication.rb
UTF-8
274
3.21875
3
[]
no_license
#!/usr/bin/env ruby i = 1 j = 1 print " " while j <= 10 print "%-4d" % j j += 1 end puts j=1 print " " 10.times {print "___ "} puts while i <= 10 print "%-4d" % i, "| " while j <= 10 print "%-4d" % (j*i) j += 1 end i += 1 j = 1 puts end
true
a565a1ccb5fe36c33d45c338bda10f72308cb60f
Ruby
PacificRebel/supremebnb
/spec/booking_spec.rb
UTF-8
1,197
2.578125
3
[]
no_license
describe @booking do before :each do @space = Space.create( name: 'taj mahal', start_date: '2019-10-23', end_date: '2020-10-23', price: 100, description: 'cool') @user = User.create(username: 'name') @date = "2019-12-25" @booking = Booking.create(space_id: @space.id, ...
true
9fd20936150262a5afdfad205ec2b11c7f21ed29
Ruby
atl15/CS169.1x
/HW01/lib/ruby_intro.rb
UTF-8
660
3.875
4
[]
no_license
# When done, submit this entire file to the autograder. # Part 1 def sum arr arr.inject(0, :+) end def max_2_sum arr arr.max(2).inject(0, :+) end def sum_to_n? arr, n arr.combination(2).any? { |a, b| a + b == n } end # Part 2 def hello(name) "Hello, #{name}" end def starts_with_consonant? s s =~ /^[^ae...
true
88bf0df0d650f0e5806faa6b9ac2b990c20b3faf
Ruby
firehoseCheckmates/ourGame
/app/models/queen.rb
UTF-8
468
2.921875
3
[]
no_license
class Queen < Piece def legal_move?(row, col) #queen can move anywhere vacant self.legal_horiz_move?(row, col) || self.legal_vert_move?(row, col) || self.legal_diag_move?(row, col) end def piece_exists?(row, col) Piece.where(row_position: row, col_position: col).exists? end def obstructed_path?...
true
57913af90dd0451914c21a429872fa2274753d9c
Ruby
msanroman/StringCalculator
/lib/String.rb
UTF-8
654
3.75
4
[]
no_license
require 'Delimiters' class String CUSTOM_DELIMITER_PREFIX = '//' CUSTOM_DELIMITER_SUFFIX = '\n' def split! delimiters = Delimiters.new(customDelimiter) regular_expression = Regexp.new(delimiters.to_s) self.split(regular_expression).collect { |number| number.to_i } end def hasCustomD...
true
ed2a91599c54af72aaae2864ceb84766a49afd73
Ruby
james1239090/mask_store
/app/models/purchase.rb
UTF-8
2,394
2.5625
3
[]
no_license
class Purchase < ApplicationRecord has_many :purchase_items, dependent: :destroy has_many :items, through: :purchase_items, source: :product validates :total_tw_price, :total_tw_duty ,:total_tw_service_fee, :total_currency_shipping_fee, :purchase_items, presence: true accepts_nested_attributes_for :purchase_it...
true
13a0bb8e69921693b1a8a9ce1d0d8b5f4bb270bf
Ruby
eugene-utkin/ruby_school_lesson_05
/app10.rb
WINDOWS-1251
611
3.0625
3
[]
no_license
# encoding: cp1251 if (Gem.win_platform?) Encoding.default_external = Encoding.find(Encoding.locale_charmap) Encoding.default_internal = __ENCODING__ [STDIN, STDOUT].each do |io| io.set_encoding(Encoding.default_external, Encoding.default_internal) end end arr = %w[ ...
true
2c3787fb991e3d1ef54d630f6cf6dbdda21f1438
Ruby
thib123/TPJ
/Notes/Ruby/sample_code/ex1142.rb
UTF-8
522
3.578125
4
[ "MIT" ]
permissive
# Sample code from Programing Ruby, page 539 class Parent def hello puts "In parent" end end class Child < Parent def hello puts "In child" end end c = Child.new c.hello class Child ...
true
cbfc284fa7842338ea9208e04965fb0b43a9b57d
Ruby
michaeleconomy/town_generator
/lib/town_generator/model/person/health.rb
UTF-8
540
2.578125
3
[]
no_license
class TownGenerator::Person < TownGenerator::Model def cause_of_death self[:cause_of_death] end def dead? self[:died_at] <= TownGenerator::Date.current end def alive? born? && !dead? end def born? birthday >= TownGenerator::Date.current end def die(date, cause) self[:di...
true
365c0b317f47e37ac2f8ee00546abb5cf7e08757
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/difference-of-squares/4c95a60c29a34e31af65ec2969172a57.rb
UTF-8
421
3.65625
4
[]
no_license
class Squares def initialize(num) @num = num end def square_of_sums square(sum) end def sum_of_squares sum(square) end def difference square_of_sums - sum_of_squares end private def square(values = (1..@num)) if values.is_a? Range values.map { |num| num ** 2 } else...
true
46c64b8fde7a061b1dbb419611eea80cf198b05a
Ruby
EthanStein/Movies2
/movies_part2.rb
UTF-8
2,730
3.09375
3
[]
no_license
class MovieData attr_reader :u, :m, :k def initialize(u, m, k, movie_data) @u = Hash.new @m = Hash.new @k = Hash.new @movie_data = [] end def load_data() prompt = '> ' puts "Hi! Which file would you like to open?", prompt #We prompted the user to give us what file to open and called...
true
b591efb3ac681f6240628c478452bac488e3f9d3
Ruby
TStrothjohann/rps-challenge
/features/step_definitions/rps_steps.rb
UTF-8
1,226
2.890625
3
[]
no_license
Given(/^I am on the homepage$/) do visit '/' end When(/^I enter my name$/) do fill_in('playername', :with=>'Thomas') end When(/^click on "(.*?)"$/) do |arg1| click_button('Start Game') end Then(/^I will see three options "(.*?)", "(.*?)", "(.*?)"$/) do |arg1, arg2, arg3| expect(page).to have_content(arg1) ...
true
77e334c944658bc5574b8eed747c73660d4253f9
Ruby
andyprickett/launch-school
/exercises/100-ruby-basics/06-user-input/10_opposites_attract.rb
UTF-8
665
3.96875
4
[]
no_license
def valid_number?(number_string) number_string.to_i.to_s == number_string && number_string.to_i != 0 end def get_validated_input input = nil loop do puts ">> Please enter a positive or negative integer:" input = gets.chomp if !valid_number?(input) puts ">> Invalid input. Only non-zero integers ...
true
1eb69ff455c81630f8921d8ea6c5a6e9771791fe
Ruby
schenkc/commutator
/not_factorable.rb
UTF-8
588
2.859375
3
[]
no_license
require './word_processing' #This should write elements of F' that are not yet factored in a file commutators = File.open("6disk_commutators.csv", "r") elements = File.open("commutators_in_16disk.txt", "r") result = File.open("in_16_notin6.txt" , "w+") counter_ex_hash =Hash.new elements.each do |line| counter_ex_h...
true
77e0855af370ba8f2b83618e54c2ed60e93fe7ba
Ruby
BrandonTat/Practice-Problems
/leetcode/problems/evaluate_rpn.rb
UTF-8
903
4.15625
4
[]
no_license
# Evaluate the value of an arithmetic expression in Reverse Polish Notation. # # Valid operators are +, -, *, /. Each operand may be an integer or another expression. # # Some examples: # ["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 # ["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6 # param {String[]} tokens #...
true
c3fd985c1d731366807649733d1af80c75f5ec48
Ruby
Jpxg/Rubyd1
/exo_09.rb
UTF-8
148
3.234375
3
[]
no_license
puts "Quel est ton prenom?" user_name = gets.chomp puts "Quel est ton nom?" user_surname = gets.chomp puts "Bonjour, #{user_name} #{user_surname} !"
true
c378c2bf21cbfe0bf0eb13299ddc8284b895f995
Ruby
zachlatta/turntabler
/examples/switch.rb
UTF-8
1,054
2.875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # On/Off bot switch require 'turntabler' EMAIL = ENV['EMAIL'] # 'xxxxx@xxxxx.com' PASSWORD = ENV['PASSWORD'] # 'xxxxx' ROOM = ENV['ROOM'] # 'xxxxxxxxxxxxxxxxxxxxxxxx' # Bot is on by default is_on = true TT.run(EMAIL, PASSWORD, :room => ROOM) do on :user_spoke do |message| i...
true
f03f5dcb771e7709ed0002814f96e93e7cf3b116
Ruby
hathach/tinyusb
/test/unit-test/vendor/ceedling/lib/ceedling/system_utils.rb
UTF-8
685
2.84375
3
[ "MIT" ]
permissive
class Object def deep_clone Marshal::load(Marshal.dump(self)) end end ## # Class containing system utility functions. class SystemUtils constructor :system_wrapper ## # Sets up the class. def setup @tcsh_shell = nil end ## # Checks the system shell to see if it a tcsh shell. def tcsh_s...
true
25baf53c6c8af93e797650d118b794269351cd0d
Ruby
srosso6/universe-game
/specs/universe_spec.rb
UTF-8
1,587
3.171875
3
[]
no_license
require("minitest/autorun") require("minitest/rg") require_relative("../map.rb") require_relative("../spaceship.rb") require_relative("../planet.rb") require_relative("../universe.rb") class TestUniverse < Minitest::Test def setup @LV426 = Planet.new("LV426", 10) @ice_pop = Planet.new("ice pop", 20) @...
true
7cd9a6c213afca00d58abbb48893353e330a6297
Ruby
gulcebasar/cs342-Design-Patterns
/project1/Axe.rb
UTF-8
124
2.578125
3
[]
no_license
require_relative 'Weapon' class Axe < Weapon def initialize() super( 2, "axe") #Axes strength is 2 end end
true
554fef2a6384e2806b8e606cdf2c528472f23cbb
Ruby
glassjoseph/black_thursday
/lib/invoice.rb
UTF-8
924
2.65625
3
[]
no_license
require_relative "../lib/data_access" class Invoice include DataAccess def merchant parent.parent.merchants.find_by_id(merchant_id) end def invoice_items parent.parent.invoice_items.find_all_by_invoice_id(id) end def items item_ids = invoice_items.map { |invoice_item| invoice_item.item_id } ...
true
cf381b2df11d4dc7e22fd04ea9030e6a9fc41534
Ruby
dmleach/advent-of-code-2019
/solver/Solver03.rb
UTF-8
5,641
3.265625
3
[]
no_license
require __dir__ + "/BaseSolver" class WireSegment def initialize currentPosition, description @startPosition = currentPosition @direction = description[0] @length = description[1, description.length].to_i end def column if orientation == "V" return @startPositio...
true
598aa6bc010e05a9515923fc6dc03f57166337dd
Ruby
jonisavo/MK-Starter-Kit
/ruby/scripts/tempdebug/tileset6.rb
UTF-8
865
2.71875
3
[]
no_license
# Creates a new tileset (normally loaded from a file) tileset = MKD::Tileset.new(6) tileset.name = "Fences & Rails" tileset.graphic_name = "fences_and_rails" # 0 = impassable # 1 = passable down # 2 = passable left # 4 = passable right # 8 = passable up # 11 = passable down, left, up # etc. # 15 = passable all tilese...
true
4e1d31e0a45d81d2815a7772ef27b56d6159c978
Ruby
DILLONDNGUYEN/cli_charities
/lib/cli_charities/cli.rb
UTF-8
1,969
3.28125
3
[ "MIT" ]
permissive
class CLI def start puts "Hello, Welcome to Charities CLI".colorize(:green) puts location #greetings and direction end def get_input input = gets.strip.downcase if input =="exit" puts "Goodbye".colorize(:red) exit elsif input == "back" self.location end return input....
true
94caa377741e8d84e6d2ee369629a5f7fb569432
Ruby
codeshowcase-pv/tictactoe
/exceptions/invalid_input.rb
UTF-8
314
2.625
3
[]
no_license
# frozen_string_literal: true class InvalidInput < StandardError attr_reader :input def initialize(input) @input = input super(message) end def message "Некоррекнтый ввод. Вы ввели #{input}. Допустимы только координаты клеток" end end
true
7c4736bb89bb53f790d50acb144a7b64c35db7ed
Ruby
mdellandrea/ruby_benchmarks
/block_vs_proc_memory_allocation.rb
UTF-8
613
3.421875
3
[]
no_license
# Memory allocation costs of creating a closure def block_call &block block.call end def just_yield yield end GC.disable y = GC.stat[:malloc_increase_bytes] block_call { 1 + 1 } z = GC.stat[:malloc_increase_bytes] GC.enable memory_change_1 = z-y #========================================================...
true
e1e3dae90515fb5e853cbdc003129e647b39590f
Ruby
execb5/.vim
/aux_scripts/merge_chapters.rb
UTF-8
1,345
2.703125
3
[]
no_license
#! /usr/bin/env ruby # frozen_string_literal: true require 'fileutils' require 'optparse' command = ARGV.shift case command when '-s' folder_name = ARGV.shift Dir.mkdir(folder_name) unless File.exist?(folder_name) ARGV.sort.each do |chapter| Dir.glob("#{chapter}/*").sort.each_with_index do |file, i| ...
true
88be2fc8394eeeaabaeb35caa999b49f70520b87
Ruby
marklombardinelson/katas
/Strings/stop_gninnips_my_sdrow.rb
UTF-8
1,713
4.3125
4
[]
no_license
# See more at - https://medium.com/@lombardinelson/basic-kata-stop-gninnips-my-sdrow-9c5e6c8c55d7 # Write a function that takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed (Just like the name of this Kata). Strings passed in will consist of only letters...
true
535dce5119a47261a19f19ca833ceb9c599806c9
Ruby
Jorge-Gingsberg/parrot-ruby-ruby-apply-000
/parrot.rb
UTF-8
65
2.734375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def parrot(squawk = "Squawk!") puts squawk return squawk end
true
069f77dcd8bfa6124aee322d8981331339644460
Ruby
haroldcampbell/angularjs-styleguide-explorer
/style-guide/extract-headings.rb
UTF-8
1,142
3.234375
3
[ "MIT", "LicenseRef-scancode-generic-cla" ]
permissive
require 'json' require './core' # def extract_headings(in_file) found_toc = false parser = Parser::Parser.new File.open(in_file).each_line do |line| if (line.match(/1\. \[/)) found_toc = true elsif found_toc parser.select_processor(line) parser.parse(line) end end parser.to_da...
true
e02791163541d71c320742a472a4019305d27a7f
Ruby
badlychadly/ttt-with-ai-project-v-000
/lib/players/computer.rb
UTF-8
488
3.203125
3
[]
no_license
require 'pry' module Players class Computer < Player def move(board) if !board.taken?("5") "5" elsif corners(board) corners(board) else board.cells.collect.with_index do |v,i| (i+1).to_s if v == " " end.compact.sample end end def corners(boa...
true
047609a334cc4233e5133c63809f0920f5f1bcdb
Ruby
biagioo/fd_schedule
/lib/fd_schedule/events.rb
UTF-8
602
3.09375
3
[ "MIT" ]
permissive
class Events attr_accessor :name, :date, :league, :location, :details @@all = [] def initialize(event_hash) event_hash.each{ |key, value| self.send("#{key}=",value)} @@all << self end # def initialize(name, date, league, location, details) # @name = name # self.send("name=",name) # ...
true
e20ee187a216be4429f1d3741c6172e8fde6eebb
Ruby
missamynicholson/takeaway-challenge
/lib/order.rb
UTF-8
771
3.203125
3
[]
no_license
require_relative 'order_calculator' require_relative 'message_system' class Order def initialize(menu:, order_calculator:, message_system:) @dishes_ordered = [] @order_calculator = order_calculator @message_system = message_system @menu = menu end def add(dish, quantity) fail "Not on menu" ...
true
ca9a72c431ce5877a73cb1398c22fa290d974991
Ruby
hackings/game_of_life
/lib/game_of_life.rb
UTF-8
2,025
3.28125
3
[]
no_license
class GameOfLife attr_accessor :x, :y, :cells, :errors, :interact_rules def initialize(x, y) @x = x @y = y @cells = Array.new(x){ Array.new(y, nil) } @errors = [] @interact_rules = [] end def add_rule(rule) interact_rules << rule end def add_cell(x, y, cell) cells[x][y] ...
true
140558c72fe83d293d40cef16006451bdca7b735
Ruby
bizzylizzy04/codecademy-ruby
/Ruby/rating_movies.rb
UTF-8
801
3.15625
3
[]
no_license
movies = { the_notebook: 4, } puts "What would you like to do?" choice = gets.chomp case choice when "add" puts "What's your favorite movie?" title = gets.chomp if movies[title.to_sym].nil? puts "What would you rate it?" rating = gets.chomp movies[title.to_sym] = rating.to_i puts "The movie #{title...
true
e61c1645c16890338983371b8219deb8b8f12633
Ruby
xis19/leetcode
/680.rb
UTF-8
228
3.640625
4
[]
no_license
def valid_palindrome(s) def valid(s) s.nil? || s.reverse == s end i = 0 j = s.length - 1 while i < j return valid(s[i + 1..j]) || valid(s[i..j-1]) if s[i] != s[j] i += 1 j -= 1 end return true end
true
2e0435752a77027f5323fb16a711c32becb318a3
Ruby
seoulstice/battleship
/test/player_test.rb
UTF-8
2,406
3
3
[]
no_license
require 'minitest/autorun' require './lib/player' require 'pry' class PlayerTest < Minitest::Test def test_player_exists player = Player.new assert_instance_of Player, player end def test_player_has_a_board player = Player.new assert_instance_of Board, player.board end def test_player_ha...
true
12affa147e35ae30070be410e0d1524de88fc402
Ruby
joneslee111/battle
/app.rb
UTF-8
797
2.703125
3
[]
no_license
require 'sinatra/base' require 'player' require 'game' class Battle < Sinatra::Base enable :sessions get '/' do erb :index end post '/names' do $p1 = Player.new(params[:p1_name]) # session allows it to exist for length of session $p2 = Player.new(params[:p2_name]) # params exist in length ...
true
ca6dbcc58edba423fcafc63e0f89c9aa4255e34e
Ruby
bonzouti/Eventbrite
/spec/models/user_spec.rb
UTF-8
1,730
2.671875
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do before(:each) do @user = User.create(first_name: "John", last_name: "Doe", description: "jambon de parme car on a besoin de plus de text") end context "validation" do it "is valid with valid attributes" do expect(@user).to be_a(User) ...
true
2b11099bbf2cf1cea07277ee4b2a5e917100e3b5
Ruby
rubberyuzu/sorting_implementation
/quicksort/quicksort_2.rb
UTF-8
464
3.828125
4
[]
no_license
class QuickSort def self.sort(arr) if arr.length <= 1 return arr else pivot = arr[0] arr.delete_at(0) # remove the pivot less = [] greater = [] arr.each do |el| if el <= pivot less << el else greater << el end end sorted_array = [] sorted_array << self.sort(les...
true
32be4ccc5d28883cc2c0414d8df4c83d8acda0a8
Ruby
shiningflint/house.rb
/house.rb
UTF-8
272
2.71875
3
[]
no_license
require "./room" require "./speaker" require "./mom" class House def initialize @lr = Room.new "Living Room" @kitchen = Room.new "Kitchen" @mom = Mom.new "Liz" @speaker = Speaker.new "Boombastic" end attr_accessor :mom, :lr, :kitchen, :speaker end
true
0521de205bd63b33350efbc4836d53864798d65a
Ruby
lyuehh/program_exercise
/ruby/ruby_test/2/socket3clict.rb
GB18030
303
2.84375
3
[]
no_license
#һĴ require 'socket' SERVER_ADDRESS = '127.0.0.1' SERVER_PORT = 30000 socket = TCPSocket.new(SERVER_ADDRESS,SERVER_PORT) read = Thread.new do while socket.gets print 'Ӧ: ' puts $_ end end while gets socket.puts($_) end socket.close
true
6863964c4844645b1cca1b69048242d89924fab2
Ruby
SheefaliT/CSCI3308
/RubyA1/RubyAssignmentP2.rb
UTF-8
800
4.90625
5
[]
no_license
#Part 2: Strings class Palindrome def initialize(string, tempvar) @string = string.downcase #input, one @ is a class variable @string = string.gsub(/[\s \W]/, '') #anything not a character, and replaces it with nothing, two pairs of quotes @tempvar = string.reverse! #trolls takes string and replaces it permanen...
true
a7e5bfa06159460e8f78bea2bf43ca22ad7ab581
Ruby
julesnuggy/oystercard_challenge_FINAL
/lib/journey.rb
UTF-8
575
3.28125
3
[]
no_license
# Journey class definiation # This takes care of all journey related things and should return journey info # when referred to class Journey attr_reader :fare, :entry_station, :exit_station MIN_FARE, PENALTY = 1, 6 def initialize(station = nil) @entry_station = station end def finish_journey(station = n...
true
ca0f0c23b73b26034f050f4fb221955d238ee1ec
Ruby
skylerto/aem
/lib/aem/cli.rb
UTF-8
4,031
2.59375
3
[]
no_license
require 'json' require 'thor' require 'yaml' module Aem # The CLI interface # # @author Skyler Layne class CLI < Thor def initialize(*args) super $thor_runner = false opts = Aem::FileParse.new.read if opts.nil? puts "must have a config file: run aem setup" else ...
true
1e5e8459329ec15831107d406adb1027dca326f5
Ruby
gnoll110/video_stick
/lib/video_stick.rb
UTF-8
197
2.53125
3
[ "MIT" ]
permissive
require "video_stick/version" require "video_stick/builder" module VideoStick class Chatter def say_hello puts 'This is video_stick. Coming in loud and clear. Over.' end end end
true
0d028842887e7bdb9d32706e450a0082dcfe4de1
Ruby
joesustaric/bowling-kata-ruby
/test/game_test.rb
UTF-8
1,716
2.796875
3
[ "MIT" ]
permissive
require 'minitest/spec' require 'minitest/autorun' require_relative '../lib/game' require_relative 'minitest_helper' describe Game do let(:perfect_game_rolls) { [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10] } let(:perfect_game_score) { 300 } let(:worst_game_rolls) { [0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0...
true
d858d04885f86d0c95c3812edbff627fdde36453
Ruby
thyagobr/verwandlung
/producer/producer.rb
UTF-8
1,271
2.6875
3
[]
no_license
require "kafka" require "oj" require 'faker' KAKFA_URLS = ["localhost:9092"] PRODUCER_NAME = 'producer' TOPIC = 'verwandlung' kafka = Kafka.new(["localhost:9092"], client_id: PRODUCER_NAME) kafka.alter_topic(TOPIC, "max.message.bytes" => 10_000_000) producer = kafka.async_producer( delivery_threshold: 20, ...
true
e734a1bbd805f00c52d7d00ad2acad3d75092edf
Ruby
jbrunton/jira-team-metrics
/app/stats/jira_team_metrics/trend_builder.rb
UTF-8
989
3.140625
3
[ "MIT" ]
permissive
class JiraTeamMetrics::TrendBuilder def pluck(&pluck_block) @pluck_block = pluck_block self end def map(&map_block) @map_block = map_block self end def analyze(series) values = series.map{ |item| @pluck_block.call(item) } series.each_with_index.map do |item, index| sample = Jir...
true
f129054f75e7cdc7fa6eb5f8e4a3ba6e6ad48b78
Ruby
wengkhing/tictactoe
/app/models/user.rb
UTF-8
773
2.75
3
[]
no_license
class User < ActiveRecord::Base # Remember to create a migration! has_many :won_games, class_name: 'Game', foreign_key: 'winner_id' has_many :games_played_as_p1, class_name: 'Game', foreign_key: 'p1_id' has_many :games_played_as_p2, class_name: 'Game', foreign_key: 'p2_id' def authenticate(pw) self.passw...
true
fbb3b2cbf42e2283f0374e33af9b8991c2d6de1f
Ruby
jeffmcfadden/colormap
/lib/colormap/colormap.rb
UTF-8
1,858
3.40625
3
[ "MIT" ]
permissive
require 'color' module Colormap include ::Color class Colormap attr_accessor :waypoints def initialize( waypoints ) self.waypoints = waypoints end def color( value: value ) value = value.to_f if value < self.waypoints[0][:value] value = self.waypoints...
true
4c3739d06a345ad376a61668139c541ed3b30867
Ruby
augustoppimenta/Cientec
/02.rb
UTF-8
151
3.375
3
[]
no_license
numer = rand(1..10) puts "Numer #{numer}" if numer > 2 puts "O numero #{numer} é maior que 2" else puts "O numero #{numer} é menor que 2" end
true
6c4dd9868dd907f088b7a1d5a13f8dd2bbd7550e
Ruby
irenafnaf/Ironhack
/week_3/user_password_authenticator/app.rb
UTF-8
936
3.59375
4
[]
no_license
# app.rb require_relative("lib/authenticator.rb") require_relative('lib/word_stuff.rb') require_relative('lib/counter_picker.rb') auth = Authenticator.new("Josh", "swordfish") # Get login credentials puts "username?" username_input = gets.chomp puts "password?" password_input = gets.chomp if auth.verify(username_...
true
73b0bb6df7f07381a56a68299ceafdaf14b64f98
Ruby
Youngermaster/Learning-Programming-Languages
/Ruby/Procedures/Procedures.rb
UTF-8
310
4
4
[ "MIT" ]
permissive
class Array def iterar block self.each_with_index do |n,y| self[y] = block.call n end end end array = [1, 2, 3, 4, 5] pow = Proc.new do |n| n**2 end plus_1 = Proc.new do |number| number + 1 end array.iterar plus_1 array.iterar pow for i in array puts i end
true
87b9901dbad57585b859dffc6affc27a1a27e518
Ruby
nickpalenchar/hacker-contacts
/lib/guide.rb
UTF-8
796
3.390625
3
[ "MIT" ]
permissive
require 'contact' class Guide def initialize(path=nil) # locate the restaurant text file at path Contact.filepath = path if Contact.file_usable? puts "[guide.rb] using file `" + path + "`" elsif Contact.create_file puts "[guide.rb]: created new Contact File" else puts "Exiting.\n\...
true
142ec974f4a07dcd6d531f0f770dc143f570aa6d
Ruby
zdennis/practice-guitar_tabs_bdd
/lib/guitar_tabs/tab.rb
UTF-8
142
2.703125
3
[]
no_license
class Tab attr_reader :notes_to_be_played def initialize(tablature, parser) @notes_to_be_played = parser.parse(tablature) end end
true
f74c409721594e3c593dc02b1953e5ee8c5effb7
Ruby
justdroo/mirror-mirror
/src/trivia/03_truthiness_control_flow/03_quiz_key_a.rb
UTF-8
2,670
3.34375
3
[]
no_license
@quiz_key_a = { section_title: "Truthiness Mini Trivia", instructions: "This is a hard one! Remember to talk it out and if you get stuck, ask for help or use the internet.", quiz: [ { type: "multiple_choice", question: "What is a boolean?", answers: { a: "A binary representation of t...
true
cf136e83b2df15b20fa4db0c50e88afaee281110
Ruby
gerard-morera/altmetric
/02-refactoring/lib/date_range_identifier.rb
UTF-8
695
3.09375
3
[]
no_license
class DateRangeIdentifier def initialize start_date, end_date @start_date = start_date @end_date = end_date end def call if same_year_and_same_day_dates? "day_format" elsif same_year_and_same_month_dates? "month_format" elsif same_year_dates? "year_format" else "...
true
c6bd0f1d60c51425d58c8979cc82da41d48cc674
Ruby
NoahZinter/fte_2103
/spec/event_spec.rb
UTF-8
7,677
3.328125
3
[]
no_license
require './lib/item' require './lib/food_truck' require './lib/event' describe Event do it 'exists' do event = Event.new("South Pearl Street Farmers Market") expect(event).is_a? Event end it 'has a name' do event = Event.new("South Pearl Street Farmers Market") expect(event.name).to eq "South ...
true
ec5b215b210f149b7e8374502d99a0700a8ed9dc
Ruby
jrayala-livecode/Prueba_Ruby
/photos_count.rb
UTF-8
163
2.703125
3
[]
no_license
def photos_count(req) photos = req["photos"] cuentas = Hash.new(0) photos.each { |photo| cuentas[photo["camera"]["name"]] += 1 } return cuentas end
true
4ab3c4f6d1881dcf86d23815096a3b0f76de2653
Ruby
jdashton/glowing-succotash
/daniel/HeadFirst/ch13_jda/lib/list_with_commas.rb
UTF-8
690
3.75
4
[ "MIT" ]
permissive
# How to join list items class ListWithCommas attr_accessor :items def join case items.length when 1 then items[0] when 2 then items.join(' and ') else (items[0..-2] << "and #{ items.last }").join(', ') end end end if $PROGRAM_NAME == __FILE__ two_subjects = ListWithCommas.new two_s...
true
91270870470f5e076156ccaa576f72e727ee0fcb
Ruby
bayendor/eventreporter
/lib/message_printer.rb
UTF-8
2,463
3.390625
3
[]
no_license
require './lib/repository' class MessagePrinter def initialize(output_stream) @output_stream = output_stream end def intro @output_stream.puts 'Welcome to Event Reporter.' program_instructions end def program_instructions @output_stream.puts 'Would you like to (l)oad a file, ask for (h)elp,...
true
3947118d2a89f03a08aae4b8228e9adfeb97c5ca
Ruby
suga/changeLogDeploy
/spec/libs/validators/validator_path_spec.rb
UTF-8
1,849
2.578125
3
[]
no_license
require File.dirname(__FILE__) + "/../../../libs/validators/validator_path" require 'tempfile' describe ValidatorPath do before(:each) do @path_not_existis = '/tmp/not_exists.yml' @file = Tempfile.new(['20130516','.yml']) @path_exists = @file.path end after(:each) do @file.close @f...
true
bb5fa4578411a46caaa6588c464c738680b296a8
Ruby
hacaravan/advent-of-code
/Day_7/day_7_q_1.rb
UTF-8
1,553
3.65625
4
[]
no_license
# From a long list of rules on which bags can contain which other bags, # determine how many different kind of bags can eventually contain the given bag type # In this case, a bright gold bag input_file = './day_7_input' # This is list of all bags together with rules for what they can contain bag_rules_list = File.re...
true
6b8e370b74b653142a4173c74f22c70d31404bb2
Ruby
hed911/applefakedata
/analyzer.rb
UTF-8
320
3.09375
3
[]
no_license
require 'csv' good_phones = 0 bad_phones = 0 CSV.foreach("dataset.csv", col_sep: ';', headers: true) do |row| performance = row[3] good_phones += 1 if performance == 'GOOD' bad_phones += 1 if performance == 'BAD' end puts "GOOD: #{good_phones}" puts "BAD: #{bad_phones}" puts "TOTAL: #{good_phones + bad_phones}"
true
476ea650a2f8ca06fbc8aa7fbbe67c8d1f7a0709
Ruby
kagemusha/speculator
/spec/scrape/stock_spec.rb
UTF-8
4,290
2.640625
3
[]
no_license
require 'spec_helper' #@SYMBOL = "msft" #@DOC = "http://quotes.wsj.com/#{@SYMBOL}/financials/quarter/income-statement" #puts "hello" #doc = Nokogiri::HTML( open @DOC ) #tables = Array.new #doc.search('table').each do|tbl| # #scrape #end QTR_TYPE = FinancialStatement::Q ANNUAL_TYPE = FinancialStatement::A PERIOD_TYP...
true
61c465c17450fdd011e2f8a3a91b32112c37ac3c
Ruby
jillirami/reverse_sentence
/lib/reverse_sentence.rb
UTF-8
1,107
4.1875
4
[]
no_license
# A method to reverse the words in a sentence, in place. # Time complexity: O(n^2) # Space complexity: O(1) def reverse_sentence(my_sentence) my_sentence = reverse_words(my_sentence) return string_reverse(my_sentence) end def reverse_words(my_words) return nil if my_words.nil? start_word = 0 end_word = 0 ...
true