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
dc3b53f5953750c3b7ee4be6e46c1dc1fbf80d85
Ruby
maxgrok/ruby-objects-belong-to-lab-cb-000
/lib/author.rb
UTF-8
112
2.546875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Author attr_accessor :name def initialize @name = name end def author @name end #has name end
true
967e71cf7e41905c847d5e6b052ab6ebbde7613b
Ruby
choncou/exercism_solutions
/ruby/rail-fence-cipher/rail_fence_cipher.rb
UTF-8
1,777
3.078125
3
[]
no_license
class RailFenceCipher VERSION = 1 def self.encode(data, rails) return data if rails == 1 @chars = data.chars @encoded_table = [] rails.times { @encoded_table << Array.new(2) } current = -1 while @chars.size > 0 0.upto(rails-2).each do |row| current += 1 @encoded_tabl...
true
08ed77e28c7872362b97e2e33f01bd7343f78f7e
Ruby
cucumber/aruba
/lib/aruba/matchers/command/have_output.rb
UTF-8
1,073
2.625
3
[ "MIT" ]
permissive
require "aruba/matchers/base/message_indenter" # @!method have_output # This matchers checks if <command> has created output # # @return [Boolean] The result # # false: # * if command has not created output # true: # * if command created output # # @example Use matcher # # RSpec.describe do #...
true
5dc7f7407390371abbe443bd8f59a3bbbd6fdf6c
Ruby
sleepingkingstudios/active_model-sleeping_king_studios
/lib/active_model/sleeping_king_studios/validations/relations/one.rb
UTF-8
1,148
2.640625
3
[ "MIT" ]
permissive
# lib/active_model/sleeping_king_studios/validations/relations/one.rb require 'active_model/sleeping_king_studios/validations/relations/base' module ActiveModel::SleepingKingStudios::Validations::Relations # The base validator for validating a one-to-one relation. class One < ActiveModel::SleepingKingStudios::Val...
true
1fea7add3c1180edda97188ee1b5e3692d237aa8
Ruby
sepandb/learn_ruby
/exercise3/game.rb
UTF-8
1,148
3.28125
3
[]
no_license
class Game def score(array) total_score = 0 partion_score = organize_score(array) partion_score.each_with_index do |frame, index| if frame[0] == 10 next_2_frames = (partion_score[index +1].to_a + partion_score[index+2].to_a).flatten total_score = total_score + frame.inject(:+) + nex...
true
96acf97e7d426df77eedb3d10db953063c7ea97e
Ruby
sunny-b/backend_practice
/180_SQL/7/query.rb
UTF-8
1,056
2.59375
3
[]
no_license
require 'sequel' DB = Sequel.connect("postgres://localhost/sequel-single-table") def format_money(number) format('%.2f', number.to_f) end dataset = DB[:menu_items] dataset = dataset.select { [item, menu_price, ingredient_cost, ((prep_time / 60.0) * 12.0).as(la...
true
2f9771abfab064f9831bda42d8745d940760c31e
Ruby
farski/rack-coffee_filter
/lib/rack-coffee_filter/filter.rb
UTF-8
944
2.515625
3
[ "MIT" ]
permissive
require "coffee-script" module Rack module CoffeeFilter class Filter def initialize(app, wrap_js = false) @wrap_js = wrap_js @app = app end def filtered_response(env) status, headers, body = @app.call(env) if !(200..299).cover?(status) return @app.cal...
true
5adf4d5a24887f1a3df6b8fbc4a74a99d46d9bf7
Ruby
StephenVarela/multi_class_programs
/Cart.rb
UTF-8
720
3.46875
3
[]
no_license
require './Product.rb' class Cart def initialize @shopping_cart=[] end def add_item(name, price) @shopping_cart << Product.new(name,price) end def delete_item(item) @shopping_cart.delete(item) end def cost_before_tax cost = 0 @shopping_cart.each do |item| cost += item.base_p...
true
921e2a73ee4aea107763aad9892a35a894a045f5
Ruby
vtasheva/ruby-retrospective-1
/solutions/03.rb
UTF-8
3,967
3.5625
4
[]
no_license
require 'bigdecimal' require 'bigdecimal/util' class Inventory attr_accessor :inventory def initialize @inventory = [] end def register(name, price, promotion = {}) new_product = Product.new(name, price, promotion) if @inventory.include? new_product raise "This product is already registered...
true
3c24d8ae61d50bd94cb65109651112c9d1a24ced
Ruby
smartpension/staging_estimator
/lib/staging_estimator/staging_date_exception.rb
UTF-8
522
2.5625
3
[ "MIT" ]
permissive
module StagingEstimator class StagingDateException < Struct.new(:reference) Data = Struct.new(:value, :date) EXCEPTIONS = [ Data.new('BX', Date.new(2015, 7, 1)), Data.new('BY', Date.new(2015, 9, 1)), Data.new('BZ', Date.new(2015, 11, 1)), Data.new('92', Date.new(2015, 6, 1)), Da...
true
494104b0d6745e9c0c0ba53cadb433daac5c0d04
Ruby
karrick/amber
/old-ruby-version/test/test-file-management.rb
UTF-8
2,063
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'fileutils' require 'test/unit' $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin')) load 'amber' # NOTE: would be interesting to have unit tests that load amber and # invoke its methods, while also having integration tests that merely # execute the binary and check...
true
7574d14eb0d813ee841ab0c857986efa0905673b
Ruby
ingenuine/awesome-support
/app/pdfs/report_pdf.rb
UTF-8
1,301
2.59375
3
[ "MIT" ]
permissive
# frozen_string_literal: true # Creates report pdf class ReportPdf < Prawn::Document require 'prawn/table' def initialize(tickets) super() @tickets = tickets _header _table _footer end def _header define_grid(columns: 5, rows: 20, gutter: 0) grid([0, 0], [1, 2]).bounding_box do ...
true
8d4a8979c315cf6f3183117773c76229d05e4b2e
Ruby
HugoLnx/hugolnx-blog
/app/models/infrastructure/postfile.rb
UTF-8
734
2.671875
3
[]
no_license
module Infrastructure class Postfile include Comparable attr_reader :path attr_reader :title attr_reader :id attr_reader :location def initialize(path) filename = File.basename path @title = title_from(filename).force_encoding('utf-8') @id = filename[0..2].to_i @locat...
true
c7021d2b05ce3ac1b1c45af7c2228424842452e9
Ruby
jimmy2/launchschool_109_assessment_ruby_and_general_programming
/video_example.rb
UTF-8
521
4.28125
4
[]
no_license
# def amethod(param) # param += " world" # param << " world" # end # str = "hello" # amethod(str) # puts str # a = "hello" # b = a # b << " world" # puts a # puts b # a += b # b << " universe" # puts a # puts b # def prefix!(str) # str.prepend("Mr. ") # end # name = "Joe" # prefix!(name) # puts name...
true
8fae4746a0009c2ced75ccab9c6ec06678252a50
Ruby
elailai94/Watts
/source-code/screens/kinematics-screens/average_speed_screen.rb
UTF-8
3,239
2.90625
3
[ "MIT" ]
permissive
#============================================================================== # Watts # # @description: Module for providing functions to work with AverageSpeedScreen # objects # @author: Elisha Lai # @version: 0.0.1 15/06/2015 #============================================================================== # Avera...
true
f18681104c4d5ee80c6a403b14b04b5e9e239d72
Ruby
cielavenir/codeiq_solutions
/nabetani_takenori/tyama_codeiq3050.rb
UTF-8
1,025
3.078125
3
[]
no_license
#!/usr/bin/env ruby #1000以下なら総当りでいいよね =begin T=[ [[0,-1,2,1],[-1,0,4,0],[0,0,1,3],[0,0,5,2],[0,-1,3,4]], [[-1,0,3,1],[-1,1,5,0],[0,0,2,3],[0,0,0,2],[-1,0,4,4]], [[-1,1,4,1],[0,1,0,0],[0,0,3,3],[0,0,1,2],[-1,1,5,4]], [[0,1,5,1],[1,0,1,0],[0,0,4,3],[0,0,2,2],[0,1,0,4]], [[1,0,0,1],[1,-1,2,0],[0,0,5,3],[0,0,3,2],[1,0...
true
3b1cd73a41c2069821438c5fa9ccb289d5af2f7e
Ruby
zezutom/euler
/problem_002.rb
UTF-8
570
4
4
[]
no_license
#!/usr/bin/env ruby class FibSummary attr_accessor :limit def initialize(limit = 10) @limit = limit end def count total = 2 fib = [1, 2] while true do index = fib.size term = fib[index - 1] + fib[index - 2] if (term > limit) break end if (term % 2 == 0) total += te...
true
4b028bff4734fb70e004045d1b65298ddd9611c7
Ruby
averysmith65/launch_school
/subscription_course/rb101_rb109_small_problems/easy_6/right_triangles.rb
UTF-8
136
3.171875
3
[]
no_license
def triangle(n) count = 1 until count == n + 1 p ' ' * (n - count) + '*' * count count += 1 end end triangle(5) triangle(9)
true
40eb7d4511ad9a5d93415d5fd56f6d2a544b1ed4
Ruby
bemurphy/berg
/lib/authentication/encrypt_password.rb
UTF-8
260
2.65625
3
[ "MIT" ]
permissive
require "bcrypt" module Authentication class EncryptPassword include BCrypt def call(input) Password.create(input) end def same?(hash, password) return false if hash.nil? Password.new(hash) == password end end end
true
ce88afe83a0a812cdfff1db15b05fb8b9a398843
Ruby
bkerley/archaeopteryx
/lib/pitches.rb
UTF-8
1,782
3.3125
3
[]
no_license
# not talking about the queens, but what? the pitches # parts stolen from jvoorhis music.rb, idea partly original, partly jvoorhis-stolen also SCALE = {"C" => 0, "C#" => 1, "D" => 2, "D#" => 3, "E" => 4, "F" => 5, "F#" => 6, "G" => 7, "G#...
true
2baf233e4b7a2954af6ba03557af1258e0edd838
Ruby
mlibrary/favorites
/lib/favorites/presenters/favorites.rb
UTF-8
310
2.625
3
[]
no_license
module Favorites module Presenters class Favorites include Enumerable def initialize(favorites) @favorites = favorites end def each(&block) @favorites.each do |favorite| block.call(Favorites::Presenter(favorite)) end end end end end
true
9977a3decb0519f33747deeacf8fd54b9b821fba
Ruby
RiotGamesMinions/motherbrain
/lib/mb/errors.rb
UTF-8
14,068
2.640625
3
[ "Apache-2.0" ]
permissive
module MotherBrain module Errors class << self # @return [Hash] def error_codes @error_codes ||= Hash.new end # @param [MBError] klass # # @raise [RuntimeError] def register(klass) if error_codes.has_key?(klass.error_code) msg = "Unable to regis...
true
4a3e0f086cc3eebbaf02c26968e41687a6b6bcbe
Ruby
thib123/TPJ
/Notes/Ruby/sample_code/ex0259.rb
UTF-8
90
2.96875
3
[ "MIT" ]
permissive
# Sample code from Programing Ruby, page 100 if false a = 1 end 3.times {|i| a = i } a
true
e86df50a824d8530031a08d44124f741c8397df1
Ruby
martinmoradi/THP-J7-Ruby_ex
/exo_03.rb
UTF-8
314
3.359375
3
[]
no_license
=begin Reprends ton programme exo_02.rb, puis écris un programme exo_03.rb qui est le même, mais avec # devant la ligne 2. Peux-tu me dire ce qu'il se passe ? =end puts "Bonjour, monde !" # puts "Et avec une voix sexy, ça donne : Bonjour, monde !" # => La ligne 2 est un commentaire donc n'est pas executée.
true
7232321096a6a76826eb83c355b90bc6d25c7e44
Ruby
ruby/rss
/test/test-setup-maker-itunes.rb
UTF-8
4,538
2.59375
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
# frozen_string_literal: false require_relative "rss-testcase" require "rss/maker" module RSS class TestSetupMakerITunes < TestCase def test_setup_maker_simple author = "John Doe" block = true categories = ["Audio Blogs"] image = "http://example.com/podcasts/everything/AllAboutEverything...
true
2880af91b2af3e016e6ec55900484c2d13c7e002
Ruby
wordjelly/Auth
/app/models/auth/concerns/owner_concern.rb
UTF-8
3,469
2.734375
3
[ "MIT" ]
permissive
module Auth::Concerns::OwnerConcern extend ActiveSupport::Concern include Auth::Concerns::ChiefModelConcern included do ## applicability of the model which implements this concern. ## every model has to be explicitly set as applicable. ## it is NOT APPLICABLE BY DEFAULT. field :applicable, type: Boolean,...
true
6807246c81b957ba5abf1de1ada8b711594f16e9
Ruby
adam-barton/favorite-wines
/db/seeds.rb
UTF-8
1,079
2.65625
3
[ "MIT" ]
permissive
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
true
dfe23f6eadedd06d46aed0f8533efc6b9aa9d0e7
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/rna-transcription/e76a99ac3035476ba2d718dd0f9d65b8.rb
UTF-8
380
3.0625
3
[]
no_license
class Complement COMPLEMENT_MAP = { 'G' => 'C', 'C' => 'G', 'T' => 'A', 'A' => 'U' } class << self def of_dna(dna) regex = Regexp.new COMPLEMENT_MAP.keys.join '|' dna.gsub regex, COMPLEMENT_MAP end def of_rna(rna) regex = Regexp.new COMPLEMENT_MAP.values.join '|' ...
true
9458ac91f978d958335190acb29e5cf933b766aa
Ruby
care0717/slack_bot
/src/common/gcp_vision_api.rb
UTF-8
2,346
2.546875
3
[]
no_license
require 'gcp/vision' require 'base64' require 'rest-client' require 'json' require 'open-uri' require 'nokogiri' module GcpVisionApi def analyze_receipt(image_file_id) token = ENV['PGRP_LEGACY_TOKEN'] public_api_url = "https://slack.com/api/files.sharedPublicURL?token=#{token}&file=#{image_file_id}" revok...
true
c04da6cac2c306f88d4d33f6e445ec765d74ab4d
Ruby
dafi/tumblr_downloader
/image_downloader.rb
UTF-8
4,729
2.75
3
[]
no_license
#!/usr/bin/env ruby # Download images from photo tumblr's posts require 'open-uri' require 'uri' require 'json' require 'fileutils' require 'optparse' require 'ostruct' require 'logger' LOG_PATH = 'images.log'.freeze ROUND_UP_PIXEL = [75, 100, 250, 400, 500, 540, 1280].freeze def parse_command_line cmd_opts = Open...
true
797174600ecc20cc0f4954a695b4099bb804ac8d
Ruby
kevinkey/klank
/dungeon.rb
UTF-8
5,280
2.90625
3
[]
no_license
module Klank require_relative "deck.rb" require_relative "utils.rb" class Dungeon COUNT = 6 attr_reader :hand def initialize(game) @game = game @deck = Deck.new(game, "dungeon.yml") @hand = [] if @game.sunken_treasures ...
true
a5d184ea68fc5671542dbb2ecedea9c406488838
Ruby
adamish/weathersupermarket
/app/helpers/providers/bbc.rb
UTF-8
1,595
2.734375
3
[]
no_license
require 'nokogiri' require 'extraction' require 'fetcher' class ProviderBbc attr_accessor :fetcher def search(search) url = "http://www.bbc.co.uk/locator/default/en-GB/autocomplete.json?search=#{search}&filter=international" content = @fetcher.getUrl(url) elements = JSON.parse(content) locations = ...
true
b85019aa745306feafb3575b04f12d1e60d04460
Ruby
MaratMikushkin/RubequeTasks
/tests/test_separating_numbers.rb
UTF-8
608
2.75
3
[]
no_license
require './test_helper.rb' class TestSeparator < MiniTest::Unit::TestCase def setup @register = Separator.new end def test_ assert_equal "1", @register.separate_with_comma(1) assert_equal "10", @register.separate_with_comma(10) assert_equal "100", @register.separate_with_com...
true
7ac8892df7313fb67a9c3fb0e03b51edd834039c
Ruby
candaceww/kwk-l1-flowchart-project-template-kwk-students-l1-seattle-072318
/app/controllers/application_controller.rb
UTF-8
799
3.03125
3
[]
no_license
require './config/environment' #require './app/models/quizz.rb' class ApplicationController < Sinatra::Base configure do set :public_folder, 'public' set :views, 'app/views' end get '/' do erb :index end post '/results' do answers = [] answers << params.values @total = 0 #at the beginning of the...
true
1968e4c0e60634c004bb4bebbe0a220109281b19
Ruby
polyfox/moon-packages
/lib/moon/packages/std/core_ext/numeric.rb
UTF-8
1,239
3.53125
4
[ "MIT" ]
permissive
class Numeric # Linear interpolation between self and target # # @param [Numeric] target # @param [Float] d # @return [Numeric] def lerp(target, d) self + (target - self) * d end # Converts the number to a degree from radians # # @return [Float] def to_degrees (57.2957795 * self).round ...
true
80b096b19e668fa9abf6c6352c6d87514f0ff10d
Ruby
tiinus/advent-of-code-2018
/day-02/day-02.rb
UTF-8
755
3.21875
3
[]
no_license
require 'pp' input = File.read("input.txt") box_ids = input.split("\n") count_two = 0 count_three = 0 box_ids.each do |tag| tag = tag .chars .group_by(&:itself) .map { |letter, list| [letter, list.count] } count_two += 1 unless tag.select { |a| a[1] == 2 }.empty? count_three += 1 unless tag.select ...
true
abbc9c5d15e0e123956025661dfa95dda388c3a8
Ruby
JLeech/introns_postgres
/ortho_group_fixer.rb
UTF-8
3,473
3.15625
3
[]
no_license
require 'csv' # class Statistics # attr_accessor :gene_id_hash # attr_accessor :path # def initialize(path) # self.path = path # self.gene_id_hash = Hash.new { |hash, key| hash[key] = empty_record } # end # def fill_and_save # puts "filling exons" # fill_exons # puts "filling introns" ...
true
355d0e432fc47db24956030cc7ceabf61ddcba1a
Ruby
Tasha25/LRTHW2016
/ex35_game_b.rb
UTF-8
3,291
3.796875
4
[]
no_license
class GamePoints def correct puts "points = #{points} in if @correct" @user_points_total = @user_points_total + 10 puts "You have #{@user_points_total} points." puts "The computer has #{@computer_points_total} points." if @user_points_total || @computer_points_total > 0 if @user_points_tota...
true
e6a2cad7dfcfa29e92b54575719f72a6668419b4
Ruby
rabram66/20120730
/test/unit/event_test.rb
UTF-8
1,390
2.59375
3
[]
no_license
require 'test_helper' class EventTest < ActiveSupport::TestCase setup do @event = events(:anonymous) end context 'geocoding' do should "happen when address changed" do @event.address = '2578 Binghamton Drive, Atlanta, GA' @event.expects(:geocode).once @event.save! end should "...
true
4a97337af0b8fe840e6642958f25968aa37361d4
Ruby
gitter-badger/transonerate
/lib/transonerate/transonerate.rb
UTF-8
661
2.703125
3
[]
no_license
module Transonerate class Transonerate def initialize assembly, genome, gtf @assembly = assembly @genome = genome @gtf = gtf @exonerate = Exonerate.new @assembly, @genome @annotation = Gtf.new @gtf end def score threads @exonerate.run threads @exonerate.parse_o...
true
f9267f5bb4d69161050b70717608e526fd275f54
Ruby
brianwang/gftop
/learning/railsLearning/BuildYourOwnRubyOnRailsWebApplications/chapter03/20_unless_else.rb
UTF-8
152
2.796875
3
[]
no_license
unless kitt.is_a?(StretchLimo) puts "This car only has room for two people." else puts "This car is licensed to carry up to 10 passengers." end
true
e771e875f8d92a187cd3db07a2fa336261344af5
Ruby
qamk/chess-top
/lib/board.rb
UTF-8
2,916
3.234375
3
[]
no_license
# frozen-string-literal: true require_relative 'pieces/knight' require_relative 'pieces/bishop' require_relative 'pieces/rook' require_relative 'pieces/queen' require_relative 'pieces/king' require_relative 'pieces/pawn' # Mechanics for interacting with the chess board class Board attr_reader :board, :old_board, :p...
true
5f21d9915510493f82b3e37984a49f0fe032123a
Ruby
krschacht/nebel
/test/factories/material_factory_test.rb
UTF-8
3,652
2.65625
3
[]
no_license
require "test_helper" class MaterialFactoryTest < ActiveSupport::TestCase setup do @exercise = exercises(:d5_part1) fixtures_root = Rails.root.join "test/fixtures/lesson_samples/" @a2 = Book::Lesson.new fixtures_root.join "volume_1/2nd_edition/a2.txt" @b22 = Book::Lesson.new fixtures_root.join "vo...
true
ded340069d81153372af8b389af386f6c859c948
Ruby
vmoyade/restaurant_service
/app/models/restaurant.rb
UTF-8
894
2.828125
3
[]
no_license
require 'data_fetch/main.rb' class Restaurant < ActiveRecord::Base attr_accessor :business serialize :business class << self def all #Overridden Active record method Rails.logger.info "Run my custom Restaurant.all" restaurants = Rails.cache.fetch("businesses") { DataFetch::Main.get_restaurants...
true
926c41049a8c72f2acca82aa26f3d8a24bdb92c1
Ruby
ToUMenu/kanji-master
/lib/kanji_master/string_extension.rb
UTF-8
636
2.609375
3
[ "MIT" ]
permissive
module KanjiMaster module StringExtension def katakana; kana end def kana converter = Converter.new converter.kana(self) end def hiragana; hira end def hira converter = Converter.new converter.hira(self) end def alphabet? reader = Reader.new reader.alp...
true
c3cac722c78a59f12c3c9be5479782507b221f0b
Ruby
anoam/atms
/spec/dispatcher_spec.rb
UTF-8
1,233
2.703125
3
[]
no_license
require_relative "../dispatcher" RSpec.describe Dispatcher do let(:command_result) { double("something") } subject { Dispatcher.new } before do subject.register("first_command") { |arguments| { command: "first_command", arguments: arguments } } subject.register("second_command") { |arguments| { command...
true
1f1c23f1f46520a34aa8c7709a3392745130c096
Ruby
ShanRubyist/algorithm
/dijkstra.rb
UTF-8
682
3.015625
3
[ "MIT" ]
permissive
inf = 2**32 map = [ [0, 1, 12, inf, inf, inf], [inf, 0, 9, 3 ,inf, inf], [inf, inf, 0, inf, 5, inf], [inf, inf, 4, 0, 13, 15], [inf, inf, inf, inf, 0, 4], [inf, inf, inf, inf, 0, 4] ] dis = map.first book = [] dis.each_with_index { |item, index| book[index] = 0 } u = 0 # core code for i in 0...map.size -...
true
adfb0515cb859d3c9ab86b3d45ca091787ad885d
Ruby
hungdowp/learn_ruby
/09_book_titles/book.rb
UTF-8
334
3.484375
3
[]
no_license
class Book SMALL_WORDS = %w(a an and as at but by for in it nor of on or over the to up) attr_reader :title def title=(t) @title = titleize(t) end def titleize(s) words = s.split words.each { |word| word.capitalize! unless SMALL_WORDS.include?(word) } words.first.capitalize! words.join(...
true
31e87332a349fba888f480b704bb267be3769cfb
Ruby
fc-anjos/the-parrots-think
/repeated-string-hackerrank.rb
UTF-8
340
2.828125
3
[]
no_license
def repeatedString(s, n) a_total_counter = 0 remaining = 0 a_word_counter = s.count 'a' times_repeated = (n / s.length).floor() dif = n % s.length remaining = s[0...dif].count 'a' if dif != 0 a_total_counter += remaining a_total_counter += (a_word_counter * times_repeated) return a...
true
dacab7021040d563b57c0bdbcf0ec7b093aa62d2
Ruby
Axelbruget/sharebox
/app/models/folder.rb
UTF-8
1,754
2.546875
3
[]
no_license
class Folder < ApplicationRecord belongs_to :user has_many :assets, :dependent => :destroy has_many :folders, foreign_key: "parent_id", :dependent => :destroy has_many :shared_folders, :dependent=> :destroy has_many :satisfactions, :dependent=> :destroy acts_as_tree validates :name, presence:...
true
269c74f3bb4b1de0e015259ed94774435b40e8e3
Ruby
Isikapowers/flashcards
/lib/round.rb
UTF-8
2,143
3.90625
4
[]
no_license
class Round attr_reader :deck, :turns def initialize(deck) @deck = deck @turns = [] end def current_card @deck.cards.first end def take_turn(guess) new_turn = Turn.new(guess, current_card) @turns << new_turn @deck.cards.shift new_turn end def number_correct number = ...
true
9aaf22d30223f07644a3bafdeb5319bacba44c43
Ruby
sybillearmis/Jour7_Ruby
/exo_15.rb
UTF-8
232
3.546875
4
[]
no_license
puts "Quelle est ton année de naissance ?" print ">" birth_year = gets.chomp.to_i actual_year = 2020 i = birth_year while (i < actual_year) i += 1 puts i puts "En #{i}, tu avais #{i - birth_year} ans" end
true
70260e7b33c2897742b48e60b81e9cad3bdce223
Ruby
praveendhawan/training-exercises
/advanceruby/calculator/bin/main.rb
UTF-8
430
2.71875
3
[]
no_license
require_relative '../lib/calculator.rb' require_relative '../lib/user_input.rb' require_relative '../lib/calculator/not_valid_input_error.rb' require_relative '../lib/calculator/validate_input.rb' begin puts 'Please Enter the details' input_hash = UserInput.take_input calculator = Calculator.new(input_hash) re...
true
4d7649309aed7177f24deeb1f8bc44855bda831d
Ruby
esopbaek/Minesweeper
/Minesweeper.rb
UTF-8
5,679
3.640625
4
[]
no_license
require 'colorize' require 'yaml' class Minesweeper def initialize self.play end def play size = get_user_setting @board = Board.new(size, size, size*2) until @board.over coordinates = get_user_coordinates action = get_user_action @board[coordinates].flag if action == 'f' ...
true
e712c5b67cde655ffd07897964656b839058f491
Ruby
blambeau/anagram
/lib/anagram/matching/type_matcher.rb
UTF-8
422
3.03125
3
[ "MIT" ]
permissive
module Anagram module Matching # Matches when the matched object is of a given module. class TypeMatcher < Matcher # Create a type matcher for a specific module def initialize(mod) raise ArgumentError unless Module===mod @mod = mod end # Matching oper...
true
e736cb46b22490ea54ff26edb9a07269f03bef13
Ruby
anton-3/discord-game-bot
/connect-4/board.rb
UTF-8
3,564
3.453125
3
[]
no_license
# frozen-string-literal: true module Connect4 # logic for all game boards class Board attr_reader :turn_count, :contents, :legal_moves def initialize(p1_color, p2_color) @turn_count = 1 @colors = { 1 => p1_color, -1 => p2_color } @legal_moves = (0..6).to_a @contents = [] 7.ti...
true
4d69e41793d735c076dc114c41bfbc8064cb52e0
Ruby
jparker0190/sinatra-cms-app-assessment-v-000
/app/models/concerns/slugifiable.rb
UTF-8
247
2.71875
3
[]
no_license
module Slugifiable module InstanceMethods def slug self.username.downcase.gsub(" ", "-") end end module ClassMethods def find_by_slug(slug) name = slug.gsub("-", " ") self.all.find {|obj| obj.username == name} end end end
true
7789cde3b2a8a6c37b4918b17406ed30fadf17ce
Ruby
CritJen/apples-and-holidays-seattle-web-career-021819
/lib/holiday.rb
UTF-8
1,704
3.890625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def second_supply_for_fourth_of_july(holiday_supplies) holiday_supplies[:summer][:fourth_of_july][1] end def add_supply_to_winter_holidays(holiday_hash, supply) holiday_supplies[:winter][:christmas] << supply holiday_supplies[:winter][:new_years] << supply end def add_supply_to_memorial_day(holi...
true
2099e07e75d109ffc523f70d3362924767d50b70
Ruby
kgjtrdghnboiuthtd/J7
/Ex1/exo_06.rb
UTF-8
101
3.140625
3
[]
no_license
puts "Choisi un nombre" i = gets.chomp.to_i i = i -1 i.times do puts "Salut, ça farte ?🍀" end
true
102d2ae30fe4d98a90d6525fe3cb0bb7df26edd9
Ruby
pietrogll/ruby_utils_algorithms
/design_patterns/behavioral_patterns/strategy.rb
UTF-8
1,234
3.765625
4
[]
no_license
# The strategy pattern (also known as the policy pattern) is a behavioral design pattern that enables selecting an algorithm at runtime. Instead of implementing a single algorithm directly, code receives run-time instructions as to which in a family of algorithms to use. Strategy lets the algorithm vary independently f...
true
c540f07cb3bf0ee4407cc74b5e336dfed103d2ff
Ruby
ColmTang/Advent_of_Code
/day1b.rb
UTF-8
272
3.546875
4
[]
no_license
input = [] IO.foreach("day1a.txt") do |line| input << line.to_i end input = input.map do |element| output = 0 until element <= 0 element = (element/3)-2 if element > 0 output += element end end output end puts input.inject {|sum, x| sum + x }
true
80cb830e35c27a375067babf05c444e6b3fcbc84
Ruby
marianosimone/jugame
/lib/strategy.rb
UTF-8
769
2.875
3
[ "Unlicense" ]
permissive
require 'observer' module JugaMe # Base class for all Strategies, it provides common functionality, like the ability to be notfied about the other players' last actions class Strategy include Observable include LovelyParent attr_reader :possible_actions, :others_actions def initialize(possible_actions) @...
true
5edf077db711400c1a685f770d8fb19873d2fc4e
Ruby
kachick/striuct
/test/test_subc-f_name.rb
UTF-8
13,967
2.6875
3
[ "MIT" ]
permissive
# frozen_string_literal: false require_relative 'helper' class Test_Striuct_Subclass_Name < Test::Unit::TestCase # for peep origin_autonyms = nil origin_aliases = nil Subclass = Striuct.define do origin_autonyms = @autonyms origin_aliases = @aliases member :foo member :bar alias_member ...
true
08bc4a9ea53c1d1d47eefbb23acbb9656ba1394f
Ruby
victornava/exercises
/2016.three-more-list-manipulation-exercisess.rb
UTF-8
1,698
4.03125
4
[]
no_license
# https://programmingpraxis.com/2016/10/14/three-more-list-manipulation-exercises/ # # THREE MORE LIST MANIPULATION EXERCISES # # We have three more list-manipulation exercises today, for those students midway # through their beginning programming course who need practice with linked lists: # # Task 1 # Define a functi...
true
cc2fbb399852ca1456c2b2d2cb488357b4ad2306
Ruby
jungomi/mdn_query
/lib/mdn_query/document.rb
UTF-8
1,673
2.859375
3
[ "MIT" ]
permissive
module MdnQuery # A document of an entry of the Mozilla Developer Network documentation. class Document # @return [String] attr_reader :title, :url # @return [MdnQuery::Section] the top level section attr_reader :section # Creates a document filled with the content of the URL. # # @par...
true
e23f9f2f7d08f14d784d4a2d3e8e1b6ff8c2e0fb
Ruby
jpclark6/backend_prework
/day_1/ex11.rb
UTF-8
629
4.34375
4
[]
no_license
print "How old are you? " age = gets.chomp print "How tall are you? " height = gets.chomp print "How much do you weigh? " weight = gets.chomp puts "So, you're #{age} old, #{height} tall and #{weight} heavy." print "What is your favorite color? " color = gets.chomp print "Where is your dream vacation? " vacation_locat...
true
efb1844a2d40fd8d7b3ba945e593f16d31e90cc1
Ruby
zapofafu/gitlab_ruby
/lib/gitlab_ruby/api_errors.rb
UTF-8
1,259
2.671875
3
[ "MIT" ]
permissive
module GitlabRuby def self.format_error(resp) resp.body end def self.check_response_status(resp) if resp.body case resp.status when 400 then raise BadRequestError, format_error(resp) when 401 then raise UnauthorizedError, format_error(resp) when 403 then raise ForbiddenError, form...
true
e41eee354067add80cd0e4ad2a42df5997a162d9
Ruby
McGaelen/advent-of-code-2020
/utils.rb
UTF-8
241
3.1875
3
[]
no_license
def openInput(transform = :chomp) inputArray = [] file = open('input.txt') if file == nil puts "couldn't find file" exit 1 end file.each do |thing| inputArray.push thing.method(transform).call end inputArray end
true
b58991255f2cb9f20a9e7e2dca8606b56d4f7514
Ruby
ChelseaC13/solar-system
/planet.rb
UTF-8
507
3.6875
4
[]
no_license
class Planet attr_reader :name, :color, :mass_kg, :distance_from_the_sun_km, :fun_fact def initialize(name, color,mass_kg, distance_from_the_sun_km, fun_fact) @name = name @color = color @mass_kg = mass_kg @distance_from_the_sun_km = distance_from_the_sun_km @fun_fact = fun_fact end def s...
true
35131ab68c973380f5a0d78805a5b22be519640e
Ruby
AjayMahen/Day2
/max.rb
UTF-8
739
4.03125
4
[]
no_license
# Find the maximum def maximum(arr) x = arr.length if x > 0 until x == 1 if arr[x-1] > arr[x-2] arr.delete_at(x-2) else arr.delete_at(x-1) end x = arr.length end return arr else return nil end end def maximum_b(arr) highest = arr.first arr.each do |x| ...
true
8c7e2ba180aab1543ca34a02a27f2a0f66bf8644
Ruby
destinyd/shenmajia
/lib/get_more_info.rb
UTF-8
1,476
2.515625
3
[]
no_license
class GetMoreInfo URLS={liantu: 'http://www.liantu.com/tiaoma/query.php'} #PARAMS={liantu: 'ean'} attr_accessor :provider, :params, :result, :url def initialize(args) @provider = args[:provider] @params = args[:params] @url = URLS[@provider] end def post barcode @result = RestClient.post @...
true
59c06a2596af37776d611fc1d12a9b1b2e58fa50
Ruby
AEminium/plaid-lang
/tartan/lib/parser/ast/decl.rb
UTF-8
1,136
2.953125
3
[]
no_license
module Parser module AST class Decl attr_accessor :linum, :id, :indent_level, :parent_node, :children, :and_states attr_reader :primary_state def initialize(linum, indent_level, id, and_states, primary_state) @linum = linum @id = id @indent_level = indent_level @a...
true
3e406053381be32b062c963a59a3be328c3459e1
Ruby
mvz/ripper_ruby_parser
/lib/ripper_ruby_parser/sexp_handlers/helper_methods.rb
UTF-8
3,459
2.671875
3
[ "MIT" ]
permissive
# frozen_string_literal: true module RipperRubyParser module SexpHandlers # Utility methods used in several of the sexp handler modules module HelperMethods def extract_node_symbol(exp) ident, = extract_node_symbol_with_position(exp) ident end def extract_node_symbol_with_p...
true
3ddedf35c5b07bd80cbf091ac8a86197ccdbed80
Ruby
semyondv/graphics
/test.rb
UTF-8
857
2.953125
3
[]
no_license
require 'ruby2d' @CENTER_X = (get :width) / 2 @CENTER_Y = (get :height) / 2 @MUL = (get :height) / 70 def fn(x) Math::cos(0.5*x) #x**2 #14/x end def reset_step(x, st, &f) y1 = f.call(x) y2 = f.call(x + st) if (y1 - y2).abs > 1.0 [st / (y1 - y2).abs, 0.001].max else st en...
true
22e2c97d054f89944217192740b4a752698aabe4
Ruby
BENSEBTI/speedtest
/speedtest.rb
UTF-8
393
3.125
3
[]
no_license
def speed(size,speed) convert = speed * 0.125 result = (size / convert) time = result return "your estimated download time is : " + Time.at(time).utc.strftime("%H:%M:%S")+ " happy dowloading :)" end puts " please do tell your file size in MB ? " size = Integer(gets.chomp).to_f puts " please do tell your inter...
true
258df3d23264ceaa8b168132b80268e104e6c8e8
Ruby
isabel22/fake_tag
/lib/fake_tag/base.rb
UTF-8
1,313
2.8125
3
[ "MIT" ]
permissive
module FakeTag module Base def generate amount = nil result = [] if amount.nil? #result = self.loop 4 result = self.get_tag else #result = self.loop amount result = self.get_tag amount end result end protected def tag_pool # TODO ...
true
f2774260780a3afd18e28eaf37726cd4fbe3e42d
Ruby
csinitiative/simplemapper
/test/unit/attribute_pattern_test.rb
UTF-8
1,806
2.625
3
[]
no_license
require 'test_helper' class SimpleMapperAttributePatternTest < Test::Unit::TestCase context 'A SimpleMapper::Attribute::Pattern instance' do setup do @class = SimpleMapper::Attribute::Pattern @pattern = /^a+/ @instance = @class.new(@name = :pattern_collection, :pattern => @pattern) end ...
true
696c9a9054bf5bc6b2cc0e28910fca443b8038d2
Ruby
caiofct/pagseguro-ruby
/lib/pagseguro/credit_card.rb
UTF-8
973
2.5625
3
[ "Apache-2.0" ]
permissive
module PagSeguro class CreditCard include Extensions::MassAssignment include Extensions::EnsureType # The Credit Card Token attr_accessor :token # The installment quantity. attr_accessor :installment_quantity # The installment value. attr_accessor :installment_value # The amount o...
true
55b6c17e95d6bda824fb0b0008416ddaf32f2c8b
Ruby
SelenaSmall/search-term
/spec/models/term_spec.rb
UTF-8
1,647
2.796875
3
[]
no_license
require 'rails_helper' describe Term do # it 'returns null if there are no terms in the database' do # expect(Term).to receive(:count).and_return(0) # expect(Term.get_term(1)).to eq nil # end context '1 term in the database' do let(:mock_term) { double('term') } before do allow(Term).to r...
true
e2c1bbbfe4d56191526f9bf91e92b1ddc799b0a7
Ruby
bcfsu/playlister-sinatra-v-000
/app/models/artist.rb
UTF-8
316
2.640625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Artist < ActiveRecord::Base has_many :songs has_many :genres, :through => :songs #TODO: Strip out special characters as well: '"/?!@#$%^&*() def slug self.name.downcase.gsub(" ", "-") end def self.find_by_slug(slug) self.all.detect do |artist| artist.slug == slug end end end
true
312124d5871040185361b209dc1a9472cde4d32f
Ruby
simplay/rubynopoly
/rubynopoly.rb
UTF-8
1,130
2.859375
3
[ "MIT" ]
permissive
#!/usr/bin/env jruby require "rubygems" # require "imageruby" require "pry" require 'optparse' require_relative 'src/game.rb' require_relative 'src/view.rb' require_relative 'src/controller.rb' Version = "0.0.1" user_args = {} opt_parser = OptionParser.new do |opt| opt.banner = "Usage example: ruby rabpt.rb -p 4 -...
true
e807a2454634ac3d0cde3661eb74e0da8920832c
Ruby
rcm32000/apollo_13
/spec/models/astronaut_spec.rb
UTF-8
1,555
2.703125
3
[]
no_license
=begin As a visitor, When I visit '/astronauts' I see the average age of all astronauts. (e.g. "Average Age: 34") =end require 'rails_helper' describe '/astronauts' do it 'should show average age of astronauts' do mission = SpaceMission.create(title: 'Apollo 8', trip_length: 100) astronaut1 = mission.astrona...
true
3456921f3124f4f70e836f8b8c7bc5b6fd96cf92
Ruby
brentvale/codingpractice
/TreeNode/00_tree_node.rb
UTF-8
1,139
3.671875
4
[]
no_license
class PolyTreeNode def initialize(value) @value = value @parent = nil @children = [] end def parent @parent end def parent=(parent) unless @parent == nil #remove this node from previous parent @parent.children.delete(self) end @parent = parent unless @parent =...
true
cef9413c9c83c3823dfcb0115148e189eb65443e
Ruby
Diazware12/GIGIH_BE_Bangsa
/module7/session1/part1/payment.rb
UTF-8
357
2.953125
3
[]
no_license
class Payment attr_accessor :input, :tax def initialize(params) input: params['input'], tax: params['tax'] end def compute case working_level when @input == 1 3000000 - (3000000 * @tax) when @input == 2 4000000 - (4000000 * @tax) when @input == 3 5000000 - (5000000 * @tax) ...
true
3dd17603455b5b4d11370850151b0d7c4df8944d
Ruby
PoweredByRobots/song_genre_updater
/genre_updater.rb
UTF-8
3,464
3.0625
3
[]
no_license
#!/usr/bin/env ruby require 'bundler/setup' require 'musicbrainz' require 'mysql2' require 'pry' def options { host: ENV['SONGS_DB_HOSTNAME'], username: ENV['SONGS_DB_USER'], password: ENV['SONGS_DB_PWD'], database: ENV['SONGS_DB_NAME'] } end def preserve_genres %w(Christmas art01 fraser18 dhr) end ...
true
1363e8833f8ca137686bbbe18d6aa198c38e3bdf
Ruby
dazuma/toys
/toys-core/lib/toys/standard_middleware/show_help.rb
UTF-8
15,022
2.578125
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Toys module StandardMiddleware ## # A middleware that shows help text for the tool when a flag (typically # `--help`) is provided. It can also be configured to show help by # default if the tool is a namespace that is not runnable. # # If a tool is not run...
true
2ecd0f938e3010d1cae0a519c9de1904802bd730
Ruby
adaveniprashanth/MyData
/ruby_training/ver_1_file_copy.rb
UTF-8
948
3.703125
4
[]
no_license
#include <ruby.h> require 'fileutils' puts "Hello, World! me"; #opening the file and reading the contents file = File.open("clip_paths.txt") array = file.readlines.map(&:chomp) file.close #printing current working directory path = Dir.getwd puts path #creating the new directory in the current folder Dir.mkdir("MPE...
true
b8e796e16703297cd3700cef3bebb2229362b5cf
Ruby
Rianasoa/mini_jeu_poo
/app_2.rb
UTF-8
1,824
3.515625
4
[]
no_license
require 'bundler' Bundler.require require_relative 'lib/game' require_relative 'lib/player' puts "------------------------------------------------" puts "|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |" puts "|Le but du jeu est d'être le dernier survivant !|" puts "------------------------------------------------" ...
true
a68b9aba47280fa48aef3e59097c73ef49862c9a
Ruby
paulentine/slack-cli
/specs/workspace_spec.rb
UTF-8
4,316
2.625
3
[]
no_license
require 'minitest' require_relative 'test_helper.rb' describe "Workspace" do before do VCR.use_cassette("load_workspace") do response = SlackAPI::User.load response2 = SlackAPI::Channel.load @workspace = SlackAPI::Workspace.new(users: response, channels: response2) end end describe "s...
true
d8a687b38b55f9476226f379cfd6514021133f1d
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/hamming/a752921c14494e47b5916bfc9c7cacb1.rb
UTF-8
261
3.40625
3
[]
no_license
class Hamming def self.compute(strand, other_strand) strand = strand.scan(/\w/) other_strand = other_strand.scan(/\w/) strand.each.with_index.inject(0) do |memo, (char, index)| char == other_strand[index] ? memo : memo +=1 end end end
true
4fa48c02b64336aeb43378d74053224df52fc68c
Ruby
RetynaGirl/enigma
/lib/key_applier.rb
UTF-8
524
3.078125
3
[]
no_license
# frozen_string_literal: true # Applies key hashes to incoming messages class KeyApplier @@ordered_characters = (97..122).map(&:chr).push(' ') def self.apply_key(message, key) message.downcase.split('').map.with_index do |character, idx| wrap_apply(character, key[idx % 4]) end.join end def self...
true
f5152569ddc80f85e51c8ba140799a310a026cf1
Ruby
sa2taka/rootine
/vendor/bundle/ruby/2.6.0/gems/rspec-expectations-3.8.3/lib/rspec/matchers/built_in/be_kind_of.rb
UTF-8
930
2.703125
3
[ "MIT" ]
permissive
module RSpec module Matchers module BuiltIn # @api private # Provides the implementation for `be_a_kind_of`. # Not intended to be instantiated directly. class BeAKindOf < BaseMatcher private def match(expected, actual) if actual_object_respond_to?(actual, :kind_of?...
true
3eae9a3bc084e847801d606730c4147f5eee426a
Ruby
marlbones/CFA-Temperature-Project
/temp.rb
UTF-8
2,185
3.796875
4
[]
no_license
#Access the following files and gems require './progressbarsingle' require 'paint' require 'terminal-table' #Questioner class class Questioner def initialize @questions = [ "What was the temperature on Monday?", "What was the temperature on Tuesday?", "What was the temperature on Wednesday?", "...
true
7d96b8cc1c8e8733cfcab5ecc0bedd5f2784c5be
Ruby
marcrowindo/SECURA
/db/seeds.rb
UTF-8
1,384
2.515625
3
[]
no_license
puts "Destroying all the quotes." Quote.destroy_all quote_attributes = [ { supplier_name: 'Securitas', supplier_address: 'Potsdamer Straße 88 10785 Berlin', phone_number: '030 5010000', price: nil, token: nil, request_id: nil },...
true
7413e4cd03fbd017296161eae0ea9dc118285162
Ruby
emilyjf/rspec_testing
/calculator.rb
UTF-8
1,799
3.84375
4
[]
no_license
# require 'rspec' # class Calculator # def add(number_one, number_two) # return number_one + number_two # end # def subtract(number_one, number_two) # return number_one - number_two # end # def multiply(number_one, number_two) # return number_one * number_two # end # def divide(dividend, d...
true
907aaacd3e7ed5a48fdd74f746f9fc67211200fe
Ruby
payload-code/payload-ruby
/lib/payload/arm/session.rb
UTF-8
1,293
2.75
3
[ "MIT" ]
permissive
require 'payload/arm/request' module Payload class Session attr_accessor :api_key, :api_url def initialize(api_key, api_url=nil) @api_key = api_key @api_url = api_url || Payload.URL Payload.constants.each do |c| val = Payload.const_get(c) ...
true
71c24a39e9f12d5c865cbfb3dd7d9f209969d24c
Ruby
bkoski/each_with_context
/test/test_each_with_context.rb
UTF-8
6,123
2.875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require File.dirname(__FILE__) + '/test_helper' class TestEachWithContext < Test::Unit::TestCase context "first?" do setup do @collection = [1,2,3,4] end should "return true on last element" do @collection.each_with_context do |num,c| assert c.first? if num == 1 end end ...
true
c9383bb2c1c83c94bf05931332b81ab6f1870e43
Ruby
somethinrother/bitmaker_lessons
/inheritance_3/moon.rb
UTF-8
353
3.453125
3
[]
no_license
class Moon < Body attr_accessor(:name, :mass, :month, :planet) def initialize(name, mass, month, planet) super(name, mass) @month = month @planet = planet end def moon_stats puts "I am #{name}, my mass is #{mass.round(2)}kg, and I am in orbit around #{planet.name}, which it takes me #{month} ...
true
f6261dcf34cc07e481069099f7a6deebab1beafd
Ruby
chonnessey/burger_week_api
/db/seeds.rb
UTF-8
1,480
2.78125
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # ...
true
5498ecc3d18c7dd97794ffe25cd96e4c77a48c4c
Ruby
mattgellert/regex-lab-immersive-alum
/lib/regex_lab.rb
UTF-8
452
3.203125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def starts_with_a_vowel?(word) !!word.match(/\A[aeiouAEIOU]/) end def words_starting_with_un_and_ending_with_ing(text) text.split(" ").grep(/\Aun.+ing\z/) end def words_five_letters_long(text) text.split(" ").select{|x| x.length == 5} end def first_word_capitalized_and_ends_with_punctuation?(text) !!...
true