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
b67cc1bb85a9100effd4fab582c128e28dc29af0
Ruby
Superbuddha/bus-stop-lab
/specs/bus_stop_spec.rb
UTF-8
590
3.015625
3
[]
no_license
require("minitest/autorun") require("minitest/rg") require_relative("../bus_stop.rb") require_relative("../person.rb") class BusStopTest <MiniTest::Test def setup() @stop = BusStop.new("Buchanan Terminal") @passenger1 = Person.new("Mark", 37) @passenger2 = Person.new("Joanna", 32) @Passenger3 = Person.new("De...
true
f0f4c0e9d106d936c266a593b3514ea44da36e6a
Ruby
detonih/oneBitCode_ruby_puro
/chamadas_web/web_get_google.rb
UTF-8
251
3.140625
3
[]
no_license
require 'net/http' # Chama module Net classe HTTP metodo get google = Net::HTTP.get('www.google.com', '/') # Se não existir o arquivo sera criado. 'w' sobrescreve o conteudo do arquivo File.open('google.html', 'w') do |line| line.puts(google) end
true
8b235f9cff55dc9b46f52eefd733c494b88a2d69
Ruby
Diazc1/cocktails
/lib/cli.rb
UTF-8
1,877
3.46875
3
[ "MIT" ]
permissive
class CLI def initialize API.new.get_margarita_data end def start greeting menu end def user_input gets.strip end def menu selection = user_input if selection == "margarita" margaritas_list menu els...
true
2d25cc534a1a79f83c1bd811be50a94eeff4639a
Ruby
fishcereal/programming-univbasics-nds-nds-to-insight-with-methods-atlanta-web-010620
/lib/nds_extract.rb
UTF-8
886
3.515625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'directors_database' # Write a method that, given an NDS creates a new Hash # The return value should be like: # # { directorOne => allTheMoneyTheyMade, ... } def directors_totals(nds) # p nds[:movies] result = {} nil # start outside loop counter = 0 while counter < nds.length do tot...
true
5df9baf092727a7fe4f098aa39f8ad00369ca657
Ruby
AliZainoul/mini_jeu_POO
/app1.rb
UTF-8
1,821
3.328125
3
[]
no_license
require 'bundler' Bundler.require require_relative 'lib/game' require_relative 'lib/player' #binding.pry puts "------------------------------------------------ |Bienvenue sur 'ILS VEULENT TOUS MA POO' ! | |Le but du jeu est d'être le dernier survivant !| -------------------------------------------------" puts "V...
true
85eed88df136c78ccd6a2c310105813e160c1cda
Ruby
pironim/yummy_mummy
/lib/tasks/compare_yml.rake
UTF-8
1,221
2.828125
3
[]
no_license
# https://gist.github.com/dommmel/7da6ee376866771c7514 desc "Compare two yml files: bundle exec rake compare_yml['coc/en','coc/pl']" task :compare_yml, [:locale1, :locale2] => :environment do |t, args| LOCALE_1 = "config/locales/#{args[:locale1]}.yml" LOCALE_2 = "config/locales/#{args[:locale2]}.yml" require 'y...
true
e6cf1838a063f5d370eb99898ee2066aaf48a1cb
Ruby
devacademyla/ruby-ejemplos
/fundamentos/06-hashes.rb
UTF-8
1,681
3.546875
4
[]
no_license
# Los hashes son diccionarios de datos donde se tiene una llave y un valor. # Un hash puede declararse asi: comunidades = Hash.new {} # Tambien existe esta otra forma: comunidad_anillo = Hash[ :elfo, 'Legolas' , :mago, 'Gandalf' , :enano, 'Gimli' ] # Otra manera de declarar es la siguiente: comunidad_anillo = Hash[ :el...
true
b9c0cf759ba17fe767863e17aef3302f8f9437cc
Ruby
elmward/adventofcode2020
/6/part2.rb
UTF-8
278
2.96875
3
[]
no_license
def count_answers(group) group.join.chars.group_by { |answer| answer }.count { |_, answers| answers.count == group.count } end def main puts(File.foreach('./input.txt', "\n\n").map do |group| count_answers(group.split) end.sum) end main if __FILE__ == $PROGRAM_NAME
true
75b5dc792d3907aa1cf21305bb326d2ccbde5976
Ruby
vkurnavenkov/algorithms
/data-structures/lru_cache.rb
UTF-8
2,111
3.765625
4
[]
no_license
Node = Struct.new(:key, :value, :next, :prev) class LRUCache =begin :type capacity: Integer =end def initialize(capacity) @capacity = capacity @size = 0 @data = {} @head = nil @tail = nil end =begin :type key: Integer :rtype: Integer =end def get(key) ...
true
cde93df27db210a71e7cd89332b81ae8c198c36f
Ruby
Srjordao/One-Bit-Code
/Aula7/Animal/app.rb
UTF-8
217
2.734375
3
[]
no_license
require_relative 'animal' require_relative 'cachorro' puts "-- Animal---" animal = Animal.new animal.pular animal.dormir puts "---Cachorro---" cachorro = Cachorro.new cachorro.pular cachorro.dormir cachorro.latir
true
59562775def2b25565d8bb07018c0e85cdfbd629
Ruby
jarosser06/netapp
/spec/netapp_volume_spec.rb
UTF-8
1,086
2.890625
3
[ "MIT" ]
permissive
require_relative '../lib/netapp.rb' describe NetApp::Volume do before :each do @volume = NetApp::Volume.new("test_vol", 419430400, 209715200, 629145600) end describe "#new" do it "creates a new volume object" do @volume.class.should == NetApp::Volume end end describe "#name" do it "re...
true
813f53207ada1b48baa8c8b4d0c7e6f9c896d2b7
Ruby
woodRock/Dots
/lib.rb
UTF-8
5,895
3.125
3
[ "MIT" ]
permissive
#! /usr/bin/ruby require 'ruby2d' module Lib def board(_is_line, dims, squares, lines) pad = 15 sq_size = 50 # Generic window properties set title: 'Dots' set height: pad + dims * sq_size set width: pad + dims * sq_size set background: 'white' set resizable: false # Directions ...
true
c801f056e38df8a965d3397b8ae1b698c825c07e
Ruby
MunkiPhD/bench_reloader_log
/app/models/manufacturer.rb
UTF-8
468
2.515625
3
[]
no_license
class Manufacturer < ActiveRecord::Base attr_accessible :abbreviation, :name validates_presence_of :name validates_length_of :name, :in => (3..35) validates_uniqueness_of :name validates_presence_of :abbreviation validates_length_of :abbreviation, :in => (2..4) validates_uniqueness_of :abbreviation be...
true
f6c4b6c2004d8e217097343ff133a52ed8de2b3e
Ruby
nanotechz9l/pickaxe
/blocks_iterators/fibonacci_iterators.rb
UTF-8
2,274
4.96875
5
[]
no_license
#!/usr/bin/env ruby =begin A Ruby iterator is simply a method that can invoke a block of code. We said that a block may appear only in the source adjacent to a method call and that the code in the block is not executed at the time it is encountered. Instead, Ruby remembers the context in which the block appears ...
true
24de58b2ad5bb4a4dd801a9967237d7fe9cd5a97
Ruby
OSC/ondemand
/nginx_stage/lib/nginx_stage/generators/nginx_show_generator.rb
UTF-8
1,399
2.78125
3
[ "MIT" ]
permissive
module NginxStage # This generator shows the state of the running per-user NGINX process. class NginxShowGenerator < Generator desc 'Show the details for a given per-user nginx process' footer <<-EOF.gsub(/^ {4}/, '') Examples: To display the details of a running per-user nginx process: ...
true
954cd76228c84bd04140bdb97c335c22593373f1
Ruby
momchianev/test
/study/82.rb
UTF-8
362
2.78125
3
[]
no_license
## require_relative './helpers' arr = [[1,2,3,4],[1,2,3,4],[1,2,3,4]] arr2 = [[1,2],[1,2],[1,2],[1,2]] arr3 = [] if arr[0].length != arr2.length print "razlichen broi" end for row in 0 .. arr.length - 1 do arr3.push [] for col in 0 .. arr2[row].length - 1 do arr3[row].push (multiplematrices arr[r...
true
e49fb79c1187ae319c748933d682a670dc45f580
Ruby
Q-Win/morse_translator
/test/morse_translator_test.rb
UTF-8
895
3.09375
3
[]
no_license
require 'pry' require 'minitest/autorun' require 'minitest/pride' require './lib/morse_translator' class MorseTranslatorTest < Minitest::Test def test_it_exists translation = MorseTranslator.new assert_instance_of MorseTranslator, translation end def test_translate morse_translator = MorseTrans...
true
b83929ee7e1ee3dffdc99afb342d7874d4f07179
Ruby
hagasatoshi/work-for-life
/app/helpers/commits_helper.rb
UTF-8
1,197
2.546875
3
[]
no_license
module CommitsHelper def circle_style(commit_count) return 'display: none;' if @max_count == 0 || commit_count == 0 #コミット数の割合と円の面積比が一致するように割合の平方根をかける width = Constants::CIRCLE_SIZE * ((commit_count.to_f / @max_count)**(1/2.0)) height = width left = (-1) * (width / 2) top = 32 - (width / 2) ...
true
f8086f9d1f3ac573949f2af2e37a631e80c272d1
Ruby
cronin101/Distributed-Systems-Coursework
/lib/input_parser.rb
UTF-8
471
2.6875
3
[]
no_license
class InputParser def self.parse_file(filename) File.open(filename).readlines.each { |line| parse_line(line) } end def self.parse_line(line) matches = line.scan /\w+/ case (object_type = matches.shift) when 'node' Node.new((name = matches.shift), (addresses = matches)).store when 'link...
true
8d59779d65a2a20360453a42dfde079b46d9f75e
Ruby
chemcnabb/PrepTickets
/lib/page_builder.rb
UTF-8
1,859
2.703125
3
[]
no_license
require 'erb' require 'tag_helper' class PageBuilder include TagHelper attr_accessor :app, :root, :page_path def initialize(app, page_path) @app = app @root = app.root @page_path = page_path end def assets_sources name, options={} assets = app.sprockets.find_asset(name) return [] if as...
true
871afc0c3fcbe47046436759a6f22020827c4da0
Ruby
okcowboy80/Frogger
/power_up.rb
UTF-8
775
3.109375
3
[]
no_license
class Power_up attr_accessor :stop def initialize image @has_been_eaten = false @insect = image @angle = 0.0 @x = Random.rand(50...500) @y = Random.rand(30..450) @X_OFF_SCREEN = -10 @Y_OFF_SCREEN = -10 end # Method that randomly generates x and y values def get_new_...
true
bd3c6815df48b3631fb729032db480770263bdd6
Ruby
smyptl/gimmecar
/app/gimmecar/lib/spreadsheet/compiler/spreadsheet.rb
UTF-8
4,232
2.546875
3
[]
no_license
class Lib::Spreadsheet::Compiler::Spreadsheet def initialize(sheets) @sheets = sheets process_sheets end def set(args) @row_index = args.fetch(:row_index) @column_index = args.fetch(:column_index) @sheet_id = args.fetch(:sheet_id) end def parse(args) args[:sheet] ||= :current...
true
1ab38094d42432a165d25ef7fa300f53fe5167a4
Ruby
icelander/mattermost_generate_user_file
/lib/mattermost_api.rb
UTF-8
1,239
2.765625
3
[ "MIT" ]
permissive
require 'httparty' class MattermostApi include HTTParty format :json # debug_output $stdout def initialize(mattermost_url, token) @base_uri = mattermost_url + 'api/v4/' @options = { headers: { 'Content-Type' => 'application/json', 'User-Agent' => 'Mattermost-HTTParty' }, # TODO Make this...
true
70ead78b452103090b101b45f5b90e5fb21cd4fe
Ruby
dave2walsh/mini_project
/spec/controllers/contacts_controller_spec.rb
UTF-8
4,385
2.546875
3
[]
no_license
require 'spec_helper' describe ContactsController do let(:user) { FactoryGirl.create(:user, name: "freddy_2", email: "freddy_2@hawai.com", password: "freddyisin") } before(:each) do @contact = user.contacts.build(name: "Contact Freddy 2") #Must save the contact to test all actions except new and create,...
true
c8fdf5b7d6a4259c6484aaf7eae96ce6ad75e290
Ruby
Amrutamali/training
/survey_app/lib/tasks/dump_user_data.rake
UTF-8
1,141
2.765625
3
[]
no_license
=begin desc "dump file" task :dump_user_data, [:id, :name] =>:environment do|task, args| puts args puts "in task" #user1 = User.first user1 = User.find( args[:id] ) puts user1.name puts user1.email temp = user1.name.split(" ") puts temp[0] puts temp[1] # input by name str = args[:name] user2 = User.find_by(name:...
true
c3ba0bf3acc6b8fc160206206c88c8ef2f92e6e1
Ruby
iliabylich/binding_dumper
/lib/binding_dumper/core_ext/local_binding_patch_builder.rb
UTF-8
2,277
3.25
3
[ "MIT" ]
permissive
# Class responsible for building patch for local binding # # @example # data = { # file: '/path/to/file.rb', # line: 17, # method: 'do_something' # } # patch = BindingDumper::CoreExt::LocalBindingPatchBuilder.new(data).patch # patched_binding = binding.extend(patch) # # patched_binding.eval('__FIL...
true
49eb787a8c6b00f233b3d99969b5988f4d30e678
Ruby
lucasmonteiro12/tic-tac-toe
/board.rb
UTF-8
323
3.46875
3
[]
no_license
class Board attr_accessor :tiles def initialize @tiles = ["0", "1", "2", "3", "4", "5", "6", "7", "8"] end def print_board puts " #{@tiles[0]} | #{@tiles[1]} | #{@tiles[2]} \n===+===+===\n #{@tiles[3]} | #{@tiles[4]} | #{@tiles[5]} \n===+===+===\n #{@tiles[6]} | #{@tiles[7]} | #{@tiles[8]} \n" end e...
true
e1eacc31536e002e5321bf175bacae0c2985c19d
Ruby
kazunetakahashi/atcoder
/2017/1106_ABC042/C.rb
UTF-8
239
2.78125
3
[ "MIT" ]
permissive
n, k = gets.chomp.split(" ").map{|i| i.to_i} d = gets.chomp.split(" ").map{|i| i.to_s} for i in n...1000000 ok = true i.to_s.chars{|c| if d.include?(c) ok = false break end } if ok puts i exit end end
true
64d5ddf88c99d2858a7c8f6d73aa1aad77c9386e
Ruby
hascong/ExerciseForRuby
/TestReadFile.rb
UTF-8
2,090
2.90625
3
[ "MIT" ]
permissive
#! /usr/bin/ruby #encoding: UTF-8 # Input File system "printf \"The input vocabulary file is: \n\" > test_result_read_file_rb" system "cat vocab_bank_fake_small >> test_result_read_file_rb" # Test case 1 system "printf \"\nTest Case 1 The new word is a new head\n\" >> test_result_read_file_rb" system "printf \"$ rub...
true
a9815adc6b2615968562b8966b0429a32180b915
Ruby
Kole565/RubyRush
/lesson_methods/arrayCut.rb
UTF-8
843
3.734375
4
[]
no_license
def cut_array (cuting_len, source_array) if (cuting_len == nil || !cuting_len.is_a?(Numeric)) cuting_len = 3 end if (source_array == nil || !source_array.is_a?(Array)) source_array = [1, 2, 3] end res = [] index = 0 while index < cuting_len if (source_array[index]) res << source_array[index] ...
true
1f1e99f7429aff8e23fc70876f06b2a9af9fd031
Ruby
compostbrain/go-tournament-manager
/app/interactors/create_tournament_registration.rb
UTF-8
1,519
2.65625
3
[ "MIT" ]
permissive
class CreateTournamentRegistration def self.call( tournament:, player_attributes:, round_statuses:, tournament_registration_status: ) instance = new( tournament, player_attributes, round_statuses, tournament_registration_status, ) instance.call end def initia...
true
dd915834d1940bd16faf910aa2be2292205a4a74
Ruby
porf25/ruby_view_server
/block_example.rb
UTF-8
503
3.984375
4
[]
no_license
## functions can take in a block similar to the way Array#each can # i.e. [1,2,3].each {|x| x + 1} ## here we are providing a function called `wrap_around_contents` when a block is passed to it, it will yield to the block def wrap_around_contents "hey your contents =>| #{yield} |<= have been wrapped" end puts w...
true
473aa535125bcf73e929e56852f74c8ade193fce
Ruby
soemirno/heresy
/lib/counter.rb
UTF-8
259
3.171875
3
[]
no_license
class Counter def initialize @count = 0 end def render_on(html) html.heading("Hello World: #{@count}") html.tag("p"){html.text("this is fun!!!")} html.link("--"){ @count -= 1 } html.space html.link("++"){ @count += 1 } end end
true
89685428b8ca076bb710e64402dd40ba19232be8
Ruby
niclin/ios-job-list
/app/models/job.rb
UTF-8
428
2.671875
3
[]
no_license
class Job attr_accessor :id, :title, :content, :image_url def initialize(data) @id = data['id'] @title = data['title'] @content = data['content'] @image_url = data['image_url'] end def self.all(&callback) ApiClient.client.get 'jobs' do |response| models = [] models = response.o...
true
b4f31f0504f8335161c83d8d34f0ba09a8cf9747
Ruby
simonpatrick/all-about-designpattern
/data_structure/ruby/libs/macros.rb
UTF-8
670
2.859375
3
[]
no_license
def fifo_stack size=1 RubyDataStructures::FifoStack.new size end def stack size=1 RubyDataStructures::Stack.new size end def multi_array(*dimensions) RubyDataStructures::MultiDimensionalArray.new(*dimensions) end def max_heap(*array) RubyDataStructures::MaxHeap.build(array.flatten) end def linked_list(type ...
true
4acc46836e9484c8341224c874daf30f8b2fa5cc
Ruby
Joeo8/Ruby
/loop/until.rb
UTF-8
150
3.203125
3
[]
no_license
sum = 0 i = 1 until sum >= 50 sum += i i += 1 end puts sum count = 0 a = 1 while !(count >= 50) count += a a+=1 end puts count
true
d33302f97a76a3eea58605ef0b8ddd0674b9e798
Ruby
vilusa/Ruby-101
/sayilar.rb
UTF-8
810
3.75
4
[]
no_license
sayi = 2**30-1 puts sayi.class puts sayi.size # bellekte kac byte lik yer kapladigini verir tutar = 1399.1 # para cinsinden puts tutar.class # Float # Rasyonel Sayilar puts Rational(1) # 1/1 puts Rational(20/5) # 4/1 puts Rational(3,5) # 3/5 # Tip donusumleri puts "142".to_f.class # float puts "142".to_s.class # st...
true
28cad3202a4b143fa2c13b78b15370f279282f25
Ruby
chuckremes/rzmq_brokers
/lib/rzmq_brokers/broker/service.rb
UTF-8
2,445
2.8125
3
[]
no_license
module RzmqBrokers module Broker # Used by the Broker to maintain a list of Workers for the named Service. The Service # knows how to iterate, add, delete and purge workers. # # This is meant to be subclassed to add specific support for a protocol (e.g. Consensus) # class Service inclu...
true
00a2a93d7d8397df9a8b3d7f9fadf5f83f433731
Ruby
Elukoye/leetcode_challenges
/common_characters.rb
UTF-8
527
3.609375
4
[]
no_license
def common_chars(a) count_map = Hash.new(0) result = [] a.first.chars.each {|c| count_map[c] += 1 } a.each { |str| count_map.each { |c, count| count_map[c] = [count, str.count(c)].min } } count_map.each { |c, count| result += (c * count).split("") if count > 0 } result end # solution ...
true
5d23963f932c4360ba28dc97a42dcd9b6fc0ca57
Ruby
sirinath/Terracotta
/dso/tags/2.2-stable/code/base/buildscripts/archive_tag.rb
UTF-8
1,885
2.53125
3
[]
no_license
# # All content copyright (c) 2003-2006 Terracotta, Inc., # except as may otherwise be noted in a separate copyright notice. # All rights reserved # # Represents an 'archive tag': a family of relative paths that let you store # archives associated with a build (build logs, build directory archive, etc.) # in a consist...
true
f1a70c60ca074f8f145259223601fb0cfce606c7
Ruby
RBGeomaticsRob/takeaway-challenge
/spec/menu_spec.rb
UTF-8
777
2.96875
3
[]
no_license
require 'menu' describe Menu do it 'can have a list of dishes stored as a hash' do expect(subject.items).to be_a Hash end it 'can load dishes from a yaml file' do yaml_file = './menu.yml' subject.load!(yaml_file) expect(subject.items).not_to be_empty end it 'accepts a menu yml as an argument...
true
efc26876e3512eb9358f5b46d252b5a042458544
Ruby
koukimiura/cherry_book
/lib/word_synth.rb
UTF-8
690
3.640625
4
[]
no_license
# require 'logger' class WordSynth def initialize @effects = [] end def add_effect(effect) #Effectrs.newのインスタンスが渡される #test_play_with_many_effectsメソッドをするために配列化と繰り返し @effects << effect end def play(original_words) # 配列が0個でも injectメソッドは引数の値(ここではoriginal_words)をそのまま返してくれる. @effects.inject(original_w...
true
fb1259dfa223ba636f3dc62e19b4f82e8a36eeee
Ruby
kodywilson/printsly
/bin/printsly
UTF-8
1,170
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'printsly' v = ARGV case when v.empty? == true puts puts bar_top.yellow puts " "*24 + "Helps you add printers to CUPS".yellow + " "*19 puts bar_low.yellow puts # format puts "Selectable options will normally be enclosed in " + "[ ]".yellow + "'s." puts # format Menu.new.cho...
true
9c290b4b4375697399710150e6f78e6252b4ef16
Ruby
lucadegasperi/vagrant-puppet
/modules/stdlib/lib/puppet/parser/functions/validate_array.rb
UTF-8
822
3.046875
3
[ "Apache-2.0" ]
permissive
module Puppet::Parser::Functions newfunction(:validate_array, :doc => <<-'ENDHEREDOC') do |args| Validate all passed values are a Array data structure value does not pass the check. Example: These values validate $my_array = [ 'one', 'two' ] validate_array($my_array) These val...
true
cd1b9411ce78f75a6841ef667497094c141f1cec
Ruby
DavidBarriga-Gomez/Sweater-Weather
/app/poros/daily_forecast.rb
UTF-8
645
3.453125
3
[]
no_license
class DailyForecast attr_reader :high, :low, :today, :tonight def initialize(weather) @high = weather['daily']['data'].first['temperatureHigh'].round @low = weather['daily']['data'].first['temperatureLow'].round @today = weather['daily']['data'].first['summary'] @tonight = night_summary(weather) ...
true
a29caf8f2559e8e6fa01abbdac633c971bd83c7a
Ruby
antomus/problems
/lib/insertion_sort.rb
UTF-8
322
3.609375
4
[]
no_license
module InsertionSort def insertion_sort(array, &compare) array.each_with_index do |el, i| while i > 0 and compare.call(el, array[i - 1]) do array[i - 1], array[i] = array[i], array[i - 1] i -= 1 end end array end # private # def compare(a, b) # a < b # end e...
true
85b4222416baf335623e7559e159f37767edcb38
Ruby
ngeballe/ls-intro-book
/6 arrays/exercises/ex1_is_number_in_array.rb
UTF-8
350
4.40625
4
[]
no_license
# Below we have given you an array and a number. Write a program that checks to see if the number appears in the array. def number_in_array?(array, number) #array.include?(number) # or with each array.each do |item| return true if item == number end false end arr = [1, 3, 5, 7, 9, 11] number = 3 puts...
true
6e769fbfd93c2eba525c7cd38cf1a793a430103e
Ruby
alex707/L10
/deck.rb
UTF-8
397
3.453125
3
[]
no_license
# deck contain cards class Deck attr_reader :cards def initialize @cards = [] ['♠', '♣', '♥', '♦'].product(%w[2 3 4 5 6 7 8 9 10 J Q K A]).each do |s, v| c = if v.to_s == 'A' 11 else v.to_i.zero? ? 10 : v.to_i end @cards << Card.new(s, v, c) end ...
true
ea81d8fbd9aa0dea568260f96b95b342daeca2c0
Ruby
Videmor/TestingRoR
/clase2/calculate.rb
UTF-8
553
3.28125
3
[]
no_license
def add(*num) # s = 0 # num.length.times do |i| # s += num[i] # end # s num.reduce(&:+) end def subtract(*num) # s = num[0] # (num.length - 1).times do |i| # s = s - num[i + 1] # end # s num.reduce(&:-) end # < ruby 2.0 # def calculate *num # option = num[-1].class == Hash ? num.pop : {a...
true
2175d42f30de322d1ec0ddbfad42f9508482073e
Ruby
wardymate/codewars-kata
/TitleCase/spec/titlecase_spec.rb
UTF-8
591
3.015625
3
[]
no_license
require 'titlecase' describe TitleCase do tester = TitleCase.new it 'should return an empty string when passed an empty string' do expect(tester.title_case('')).to eq '' end it 'should convert the string' do expect(tester.title_case('a clash of KINGS', 'a an the of')).to eq 'A Clash of Kings' end ...
true
026e270aa51db41e2e4dcf4bee0bf121b54981df
Ruby
Asteriskx/Ice-Chan
/lib/Ice-chan/command/cmd_update_name.rb
UTF-8
2,849
2.5625
3
[ "MIT" ]
permissive
puts "Load: cmd_update_name.rb" def cmd_update_name?(status) text = status.text name = status.in_reply_to_screen_name if name == $cfg.screen_name && parser?(text, ["-n", "--update_name", "--name", "update_name", "--lock_name", "--unlock_name"]) return true else return false end end def cmd_update_n...
true
d557b620517c3f5bad38110567bcc37288d91d12
Ruby
nithinbekal/euler-ruby
/code/euler-0006.rb
UTF-8
633
4.21875
4
[]
no_license
# The sum of the squares of the first ten natural numbers is, # 1^2 + 2^2 + ... + 10^2 = 385 # The square of the sum of the first ten natural numbers is, # (1 + 2 + ... + 10)^2 = 55^2 = 3025 # Hence the difference between the sum of the squares of the first ten natural # numbers and the square of the sum is 3025 3...
true
e1160f1b10c9b2675cf775a9c14c479007605a01
Ruby
mojotech/helios2
/app/lib/clients/create_tweet.rb
UTF-8
1,610
2.65625
3
[ "MIT" ]
permissive
# Polls weather for subscribed locations class Clients::CreateTweet delegate :text, :media, :interactions, :status, :user, :created_at, to: :@tweet InteractionQuery = Struct.new(:favorite_count, :retweet_count) MediaQuery = Struct.new(:images, :link) UserQuery = Struct.new(:name, :handle, :avatar) def ini...
true
301b13249fdd4b360e5e2d7679512a664cb2fe09
Ruby
tsetsefly/launch_school-prepwork
/back_end_prep/ruby_basics_exercises/user_input/lsprint.rb
UTF-8
282
3.34375
3
[]
no_license
response = nil loop do puts "How many output lines do you want? Enter a number >= 3:" response = gets.chomp.to_i if response > 2 response.times do puts "Launch School is the best!" end break else response < 3 puts "That's not enough lines." end end
true
20d24f0e7237311c14ab8a9f85fed31899ac4266
Ruby
a2800276/des.go
/src/rb/make_test_data_cbc.rb
UTF-8
1,598
3.140625
3
[]
no_license
require "test_data_basics" require 'openssl' def cbcStruct struct = <<END type cbcTest struct { name string key [] byte iv [] byte in [] byte out [] byte } END puts struct end def head puts "package des" cbcStruct puts "var cbcDESTests = []cbcTest {" end def tail puts "}" end def random_...
true
d94368cea7989902ef6f3451ae5b997eae8ca550
Ruby
sheg/FantasyFootball
/app/helpers/leagues_helper.rb
UTF-8
8,768
2.65625
3
[]
no_license
module LeaguesHelper class WeekData attr_accessor :week_number, :start_date def initialize self.week_number = 0 end def end_date (start_date + 1.week - 1.day).end_of_day end end class DraftInfo attr_accessor :current_team, :draft_round, ...
true
49edcfa54ff42c95347483728d9b9bb1572a4b38
Ruby
iamalan/arduino_plane
/Arduino.rb
UTF-8
2,677
3.328125
3
[]
no_license
require 'rubygems' require 'YAML' require 'serialport' require 'log' require 'valuemapper' class Arduino def initialize(config_file) begin @CONFIG = File.open(config_file) { |f| YAML.load(f) } Log.instance.add "Opened Arduino config #{config_file}:" Log.instance.add @CONFIG.to_yaml ...
true
1352b488c7e79ca66da7faa0e5888452a806a9cb
Ruby
rscottm/ruby-ev3
/lib/ev3/button.rb
UTF-8
1,335
3
3
[ "MIT" ]
permissive
require 'ev3/actions/button' module EV3 class Button include EV3::Validations::Constant include EV3::Validations::Type include EV3::Actions::Button attr_writer :pressed attr_reader :name UP = 1 ENTER = 2 DOWN = 3 RIGHT = 4 LEFT = 5 BACK = 6 def initialize(but...
true
4b5b4fb8e6798412a370d5bfbc997decfcfe3bb0
Ruby
yuihyama/monkeyrock
/benchmark/subt_benchmark.rb
UTF-8
678
2.921875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'benchmark' require './lib/subt' Benchmark.bmbm do |x| x.report('2.subt(1)') { 2.subt(1) } x.report('Rational(2, 3).subt(1)') { Rational(2, 3).subt(1) } x.report('[1, 2, 3].subt(1)') { [1, 2, 3].subt(1) } x.report('(1..3).subt(1)') { (1..3).subt(1) } x.report('300_000.times { 2....
true
62ef74b73bcdddcff90980ed71e826225f9822a4
Ruby
tskorupa/soiree-gageure-2017
/app/models/ticket_listing.rb
UTF-8
811
2.578125
3
[ "MIT" ]
permissive
# frozen_string_literal: true class TicketListing extend Memoist include Enumerable attr_reader :number_filter def initialize(ticket_scope:, **options) @ticket_scope = ticket_scope @number_filter = options.fetch(:number_filter, nil) end def tickets_to_display? tickets.any? end memoize :ti...
true
8dbb23586dc526fbda9a1c68d685b614888baf20
Ruby
GabbyMont/Ruby-Programming
/Day_6.rb
UTF-8
614
4.59375
5
[]
no_license
soda_types = ["sprite", "coke", "mountain dew", "orange soda", "dr pepper", "surge"] puts soda_types[2] #2 = mountian dew because each string is its own number i.e. "sprite" is 0, "coke" is 1, "mountain dew" is 2 puts soda_type[-2] #-2 = dr pepper because when you give a negative it starts at the end of the array, ...
true
6274a06d39213f167335cb36ff35bc498e3b4728
Ruby
castle-crew/chess-group-project
/app/models/queen.rb
UTF-8
203
3.0625
3
[]
no_license
class Queen < Piece def valid_move?(x, y) if x_space == x && y_space == y return false elsif diagonal_move?(x, y) == true return true else return true end end end
true
14adb31c37c62e7816b43ee3c9f71d53d816a87c
Ruby
s11rikuya/ruby-perfect-lesson
/cycle-2/2-2-1-1.rb
UTF-8
108
3.046875
3
[]
no_license
greeting = "HELLO," people = ["Alice","Bob"] people.each do |person| puts greeting + person end outs person
true
c59086173090c68e865bd92fac47c5b1312ced2f
Ruby
mstmari/ttt-with-ai-project-v-000
/lib/players/computer.rb
UTF-8
1,276
3.421875
3
[]
no_license
# require 'pry' # module Players # class Computer < Player # def opponent_token # #if the opponent token is X then type O and vise versa # self.token == "X" ? "O" : "X" # end # # def move(board) # # # #turn one # if !board.taken?(1) # return "1" # elsif !board.taken?(3) # return "3"...
true
dbcb88dfc444643a8aa54066ecd96257f581d532
Ruby
hide83/project-euler-multiples-3-5-e-000
/lib/multiples.rb
UTF-8
403
3.265625
3
[]
no_license
# Enter your procedural solution here! require 'pry' def collect_multiples(limit) (1..limit-1).collect do |i| if i % 3 == 0 || i % 5 == 0 i end end.compact end def sum_multiples(limit) array = (1..limit-1).collect do |i| if i % 3 == 0 || i % 5 == 0 i end end.comp...
true
6d7c39bd65eaab75583f95a527c820447444783a
Ruby
coverless/peopole
/spec/platform/twitter_spec.rb
UTF-8
850
2.546875
3
[]
no_license
# frozen_string_literal: true require_relative '../../platform/twitter' describe Platform::Twitter do let(:twitter_platform) { described_class.new } describe '#account_for' do subject { twitter_platform.account_for(person) } context 'when a verified account exists' do let(:person) { 'Dillon Franci...
true
99fdc25f6853211578321db5c2760e62a9cf242a
Ruby
adrianagithub/rails-basics
/rails basics/logger.rb
UTF-8
507
3.890625
4
[]
no_license
require "logger" class BankAccount attr_accessor :name attr_reader :logger, :transactions def initialize(name) @name = name @transactions = [] @logger = Logger.new("account.txt") end def deposit(amount) logger.info "[#{name}] Deposited #{amount}" transactions.push(amount) end ...
true
b71a7bfc2ec2de698935bc7c4f05bb477c4d4305
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/anagram/763d557b03f74d629a38cb6670fe9954.rb
UTF-8
336
3.546875
4
[]
no_license
class Anagram attr_accessor :word def initialize(word) @word = word.downcase end def match(anagrams) anagrams.select do |anagram| anagrams_of(word).include? anagram.downcase end end private def anagrams_of(word) word.chars.permutation.map(&:join).reject {|anagram| anagram.eql? w...
true
89c90749b367fc87512eefb8b31de78f3d9416fc
Ruby
jasminenoack/app-academy
/poker-etc-master/lib/array.rb
UTF-8
1,732
3.4375
3
[]
no_license
class Array def my_uniq self.each_with_object([]) do |el, uniqs| uniqs << el unless uniqs.include?(el) end end def two_sum array = [] (0...length - 1).each do |i| (i...length).each do |j| array << [i, j] if self[i] + self[j] == 0 end end array end def my_t...
true
74aef2e86b0d335289dda0a8418cd33f6e3f1cfa
Ruby
boesemar/exim-quotad
/exim-quotad.rb
UTF-8
9,091
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # Documentation: # https://github.com/boesemar/exim-quotad ################################################################### ##################### CUSTOMIZE HERE ######################### ################################################################### DIRECTORY = '/var/exim-quotad' EMA...
true
9960497e59ded803ff4fccb02954cc497e40a9ad
Ruby
codedogfish/ruby-in-action
/meta/class/definition/attr.rb
UTF-8
320
3.78125
4
[]
no_license
class MyClass def my_attribute=(value) @my_attribute = value end def my_attribute @my_attribute end end obj = MyClass.new obj.my_attribute = 'x' puts obj.my_attribute class MyClass1 attr_accessor :my_attribute end obj2 = MyClass.new obj2.my_attribute = 'y' puts obj2.my_attribute
true
62eeb581ead32c94e1da07ca5688514305cb9bf1
Ruby
timbot1789/ruby-project
/atom.rb
UTF-8
518
3.359375
3
[]
no_license
=begin Implements a simple atom defined by it's atomic number. Keeps track of bonds it has to other atoms. =end require_relative "constants" class Atom def initialize(atomic_number = 6) @number = atomic_number end def number @number end def getAtomicSymbol symbol ...
true
ab5131ee3d5edd7bbabd50fb82794508de798a17
Ruby
steveoro/goggles_core
/lib/framework/interface_data_export.rb
UTF-8
4,247
2.78125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'common/format' # # = InterfaceDataExport # # - version: 3.00.02.20120204 # - author: Steve A. # # Framework "interface" Module for commonly used Data-Export methods. To be included in any # EntityBase sibling implementation. # # Refactored from the original EntityBa...
true
63a2969b631cf37e4bb782e91a8cea046beabdff
Ruby
aberant/worker-tracker
/lib/worker_tracker/server.rb
UTF-8
1,334
2.53125
3
[ "MIT" ]
permissive
require 'sinatra/base' require 'erb' require 'worker_tracker' module WorkerTracker class Server < Sinatra::Base dir = File.dirname(File.expand_path(__FILE__)) set :views, "#{dir}/server/views" set :public, "#{dir}/server/public" set :static, true helpers do include Rack::Utils def...
true
dbe05bd90936f35bb0b7ff851aea399d6f31f031
Ruby
Kriordan/shortest_sequence
/program.rb
UTF-8
148
2.5625
3
[]
no_license
require_relative 'shortest_sequence' File.foreach(ARGV[0]) do |line| sequence = ShortestSequence.new(line).shortest_sequence print sequence end
true
03761e303201a3b3da0c6972b785788b0ea609f8
Ruby
hoangtommy/sinatra
/web_guesser/web_guesser.rb
UTF-8
1,026
3.296875
3
[]
no_license
require 'sinatra' require 'sinatra/reloader' SECRET_NUMBER = rand(101) # @@guesses_left = 5 # def reset # @@guesses_left = 5 # message = 'new game, new number, new guesses' # end def check_guess(guess) if guess === SECRET_NUMBER message = "you guessed it! The secret number is #{SECRET_NUMBER}" elsif gues...
true
cdef26fa3359af4257a780551b74c828e7f4337c
Ruby
almozaz/codaisseurup
/spec/models/profile_spec.rb
UTF-8
1,092
2.546875
3
[]
no_license
require 'rails_helper' RSpec.describe Profile, type: :model do describe "validations" do it { is_expected.to validate_presence_of(:first_name) } it { is_expected.to validate_presence_of(:last_name) } end describe "#full_name?" do let(:user) { create :user } let!(:profile) {create :profile, user:...
true
8c43550e6e32c2162c5a2f1b3408c01a402007f3
Ruby
diegollams/LanguageAnalysis
/app/models/post.rb
UTF-8
3,151
3.25
3
[]
no_license
class Post < ActiveRecord::Base validates :body,:title,presence: true has_and_belongs_to_many :words before_save :evaluate has_many :evaluated_words HAPPY_VALUE = 1 SAD_VALUE = -1 NEGATION_WORDS = %w[ no nunca jamas] ENHANCERS = %w[muy mucho demasiado exagerado] REDUCERS = %w[poco nada ] def eval...
true
92de97ade3dbe42e57220e31a0707c5cedfdc06a
Ruby
WSINTRA/square_array-dumbo-web-career-021819
/square_array.rb
UTF-8
202
3.1875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def square_array(array) # your code here new_array =[] array.each do |m| output = m ** 2 new_array.push(output) end new_array end #test_array = [1,2,3,4,8] #square_array(test_array)
true
eb9a8dc90924c65fc92200fad9792c26074da61d
Ruby
hampelm/grantr
/app/lib/data_importer.rb
UTF-8
1,192
2.703125
3
[ "MIT" ]
permissive
require 'csv' class DataImporter attr_accessor :filepath def initialize(filepath) self.filepath = filepath end def import_grants csv_text = File.read Rails.root.join(filepath) csv = CSV.parse(csv_text, :headers => true) grants = [] csv.each do |row| data = row.to_hash Activ...
true
6c077888eeaf503ef2459807078baf94f4cae7ac
Ruby
fdavidcl/ruby-ten-lines
/enumerators.rb
UTF-8
2,026
4.15625
4
[ "MIT" ]
permissive
#!/usr/bin/env ruby puts <<END # Some examples of Enumerators and Enumerable # author: David Charte # license: MIT # source: https://libreim.github.io/blog/2015/08/24/ruby-enumerators/ END ################################################################################ # Primes Enumerator ###########################...
true
174d5207f7aef3faa323896574f76167a04780c9
Ruby
2called-chaos/mcl
/lib/mcl/server.rb
UTF-8
982
2.546875
3
[ "MIT" ]
permissive
module Mcl class Server attr_reader :app, :status, :players attr_accessor :version, :boottime, :world, :datapacks include Helper include Getters include IPC include IO def initialize app @app = app @version = $mcl_server_version @boottime = $mcl_server_boottime @wo...
true
fcd86c48afff0d6a41a6dbbda7f383af247de6e5
Ruby
achyutdev/voice-app
/app/classes/queue_handler.rb
UTF-8
914
2.625
3
[]
no_license
class QueueHandler attr_accessor :id def initialize(id) @id=id end def make_queue @required_id , @controller= OutboundList.find_controller(@id) selected_contact_id=LinkOutboundContact.where(:outbound_call_id => @id) @contact_in_queue=Queue.new selected_contact_id.each do |for_each_one...
true
0089a9eb6354614a367a981d0ff690ee98547d81
Ruby
allizad/searchyll
/lib/searchyou/indexer.rb
UTF-8
4,494
2.640625
3
[]
no_license
require 'json' require 'net/http' module Searchyou class Indexer BATCH_SIZE = 50 attr_accessor :indexer_thread attr_accessor :queue attr_accessor :timestamp attr_accessor :uri attr_accessor :working def initialize(elasticsearch_url) self.uri = URI(elasticsearch_url) self.qu...
true
e70fed398fce45ac9ed7fc052cc48c925da2bb0c
Ruby
danherr/ar-lite
/lib/searchable.rb
UTF-8
381
2.515625
3
[]
no_license
require_relative 'db_connection' module Searchable def where(params) if params.is_a?(Hash) results = DBConnection.execute(<<-SQL, params) SELECT * FROM #{self.table_name} WHERE #{params.map{|key, val| "#{key} = :#{key}"}.join(' AND ')} SQL ...
true
c271c0d3ab5ee528bda5427f02606c70affeb094
Ruby
HarborEng/fortuneteller
/test/inflating_int_test.rb
UTF-8
2,685
2.671875
3
[ "MIT" ]
permissive
require 'test_helper' class InflatingIntTest < MiniTest::Test def test_growth replacement_income = FortuneTeller::Utils::InflatingInt.new( int: 1000_00, start_date: Date.today ) growth_rates = FortuneTeller::GrowthRateSet.new( { inflation: [1.02, 1.03] }, start_year: Date.today.y...
true
5ea486a62076296d8525471f63ee946e8f103a46
Ruby
dsiefert/test
/dungeon_level.rb
UTF-8
12,755
2.65625
3
[]
no_license
require 'ncurses' require_relative 'point' require_relative 'tile' require_relative 'monster' require_relative 'fov' require_relative 'test_items' module Roguelike class DungeonLevel include FOV include Event::Capable include Roguelike::TestItems ROOM_RATIO_HIGH = 0.30 ROOM_RATIO_LOW = 0.20 LOOP_RATIO ...
true
9706a433507f2f9aa2762f7a6a67f1c722b88ec0
Ruby
sugiyamam/furima-19345
/spec/models/item_spec.rb
UTF-8
2,919
2.515625
3
[]
no_license
require 'rails_helper' RSpec.describe Item, type: :model do describe '#create' do before do @item = FactoryBot.build(:item) end describe '商品出品機能' context 'うまくいく場合' do it '全て入力されていれば出品できる' do expect(@item).to be_valid end end context 'うまくいかない場合' do it 'image:フ...
true
b43bee91bbcfeaf72190893a16131cb15997468f
Ruby
iFixit/nagnagnag
/log.rb
UTF-8
183
2.703125
3
[ "MIT" ]
permissive
require 'logger' class Log def self.instance @@logger ||= Logger.new(STDOUT) end def self.method_missing(method, *args) instance.send(method, *args) end end
true
41bbc8a098193e8abd3caa7a82f27f2ed4911c03
Ruby
lowentropy/more_magic
/app/helpers/application_helper.rb
UTF-8
406
2.859375
3
[]
no_license
module ApplicationHelper def emphasize_letters(text, letters) letters = letters.split '' text = text.split '' str = "" until text.empty? letter = text.shift if letter.upcase == letters[0].upcase str << "<b>#{letter}</b>" letters.shift else str << letter ...
true
680771989b2b2d0f050c1a963bb370dc0f58d173
Ruby
wrburgess/grand-central
/app/models/weather.rb
UTF-8
855
3.328125
3
[]
no_license
class Weather def initialize(zipcode) root_url = "http://api.openweathermap.org/data/2.5/weather" request_url = "#{root_url}?q=#{zipcode}" @data = ActiveSupport::JSON.decode(Nokogiri::HTML(open(request_url))) end def current_date Time.now.strftime "%a, %b %e" end def current_time Time.n...
true
6e566aa2c3038941cecffae5c4a8c2d967b0ac1e
Ruby
wagura-maurice/glowing-umbrella
/lib/api/h_mac_helper.rb
UTF-8
2,754
3.125
3
[ "MIT" ]
permissive
require 'openssl' require 'base64' require 'uri' require 'api/hash_helper' class HMacHelper def self.format_request_string(http_verb, uri, api_key, timestamp, params = nil) clean_http_verb = self.format_http_verb(http_verb) clean_uri = self.extract_api_endpoint_from_uri(uri) clean_api_key = self.format...
true
d0c9c34153587218c74033b508de7e56303c27c4
Ruby
Trevoke/SGFParser
/lib/sgf/variation.rb
UTF-8
216
2.703125
3
[ "MIT" ]
permissive
# frozen_string_literal: true class SGF::Variation attr_reader :root, :size def initialize @root = SGF::Node.new @size = 1 end def append(node) @root.add_children node @size += 1 end end
true
7391ecf71047dca69d0d550c586bfe2d4a24b3a5
Ruby
shimta020/AtCoder
/beginners_selection/c3.rb
UTF-8
1,155
3.515625
4
[]
no_license
# n = gets.to_i # arr = [] # n.times{ |n| arr << gets.split.map(&:to_i) } # ans = 'Yes' # arr.each_with_index do |_, key| # if key >= 1 # p _ # t = arr[key][0] - arr[key-1][0] # distance = (arr[key][1] - arr[key][1]).abs + (arr[key][2] - arr[key][2]).abs # if t < distance # ans = 'No' # ...
true
af26a6dbe3e25da0f230283947d0695aafac2057
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/meetup/22732905eec146888db3e9cdb9b1cc13.rb
UTF-8
736
3.5
4
[]
no_license
class Meetup WDAYS = [:sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday] ORDER = {:first => 0, :second => 1, :third => 2, :fourth => 3, :last => -1} def initialize month, year @month = month @year = year end def find_day weekday last = Date.new(@year, @month, -1).mday (1....
true
4489b01abad576f97c8707c09c43c1bc60fccdb6
Ruby
wmavis/timeclock
/app/models/model.rb
UTF-8
107
2.65625
3
[]
no_license
class Model def initialize(attributes) attributes.each do |k,v| self.send("#{k}=", v) end end end
true
5b293bed78aad8399238078eb1cb279cd3a6b7c7
Ruby
jacksonlink/JogaPedra
/Resultados.rb
UTF-8
2,920
2.921875
3
[]
no_license
#receber o array de partidas calcula as bonificacoes de cada jogada, soma as jogadas e calcula o resultado geral da partida class Resultados def initialize(value) @partidas = value end def resultado_partida @resultado_array = [] @partidas.each_with_index do |lines, index| ...
true
cbdc80f9b57f3770b49c84a52e9b416b286abb57
Ruby
zjwhitehead/iterable-api-client
/lib/iterable/in_app.rb
UTF-8
1,534
2.6875
3
[ "MIT" ]
permissive
module Iterable ## # # Interact with /inApp API endpoints # # @example Creating in app endpoint object # # With default config # in_app = Iterable::InApp.new # # # With custom config # conf = Iterable::Config.new(token: 'new-token') # in_app = Iterable::InApp.new(config) class InApp < ...
true
2df0976e8e4a8dd0582544838e90b53585f1c448
Ruby
kirtmartintx/Iron_yard_day6
/lab_redux.rb
UTF-8
1,972
3.140625
3
[]
no_license
require './shipment' puts "hai" payment = 0 leelabonus = 0 leelatrips = 0 frybonus = 0 frytrips = 0 amybonus = 0 amytrips = 0 benderbonus = 0 bendertrips = 0 venustotal = 0 jupitertotal = 0 saturntotal = 0 neptunetotal = 0 plutototal = 0 countearth = 0 countmars = 0 counturanus = 0 leelas_deliveries = 0 open("planet...
true
561f828665a5a407d3b26a241d92f137c1596856
Ruby
kaganon/reverse_sentence
/lib/reverse_sentence.rb
UTF-8
1,199
3.859375
4
[]
no_license
# A method to reverse the words in a sentence, in place. def reverse_sentence(my_sentence) return if my_sentence == nil || my_sentence == '' i = 0 end_of_s = my_sentence.length - 1 # reverse the whole sentence reverse_string(my_sentence, i, end_of_s) # reverse the words reverse_words(my_sentence) re...
true