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
ad0d28bb2f32f59b468e7ec53895338d9893cc35
Ruby
don-juancito/BrainsToBytes_CodeSamples
/RubyModules/MethodLookupExample/child_level_module.rb
UTF-8
159
2.921875
3
[]
no_license
module ChildLevelModule def print_greeting puts "Hello, I am a method in ChildLevelModule, the one you included in the child class" end end
true
0f7a27001fd73d9cabcb805651f4aae9c5ff12f7
Ruby
JaneDaragan/Hello-Ruby-
/task4.rb
UTF-8
501
3
3
[]
no_license
# 4. Заполнить хеш гласными буквами, где значением будет являться порядковый номер буквы в алфавите (например: А - 1). # Letter A B C D E F G H I K L M N O P Q R S T V X Y Z alphabet=('a'...'z').to_a vowels =["a", "e","i","o","u","y"] alphabet.each_with_index do |value, index| vowels.each d...
true
c98208edf0226ef7a96ec2ee28f7803af7b312ba
Ruby
vynhart/debtcollectorbot
/services/telegram_service.rb
UTF-8
2,310
2.609375
3
[]
no_license
require 'json' require_relative 'start_service' require_relative 'owe_service' require_relative 'lend_service' class TelegramService < Service def initialize(payload) @payload = JSON.parse(payload) @form = MessageForm.new(@payload) end def process Thread.new do begin service = get_serv...
true
4c2ac7285442f42262328108ea5be0307fcd7e08
Ruby
xmarshallsito/metodos-numericos
/ec-no-lineales.rb
UTF-8
4,627
3.34375
3
[ "MIT" ]
permissive
# Biseccion: utilizado para encontrar una aproximacion de una raiz perteneciente a (a,b) de una ecuacion f(x) = 0, # donde f es una funcion continua en [a,b] y f(a)f(b) < 0. # Entrada: los extremos a, b del intervalo, una tolerancia error, un numero maximo de iteraciones n_max y f(x). # Salida: una raiz aproximada o un...
true
6bbdc3043de44dc6160bc75ecd7a6bb0b1f3723b
Ruby
justonemorecommit/puppet
/spec/unit/functions/compare_spec.rb
UTF-8
5,220
2.625
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
require 'spec_helper' require 'puppet_spec/compiler' require 'matchers/resource' describe 'the compare function' do include PuppetSpec::Compiler include Matchers::Resource { [0, 1] => -1, [1, 0] => 1, [1, 1] => 0, [0.0, 1.0] => -1, [1.0, 0.0] => 1, [1.0, 1.0] => 0, [0.0,...
true
eb634a0a7087bde7276b62da9a03c523aed4242a
Ruby
gregory/facteur
/lib/facteur.rb
UTF-8
1,650
3.0625
3
[ "MIT" ]
permissive
require "facteur/version" require 'facteur/factory' module Facteur def self.included(host_class) host_class.extend ClassMethods end class Factory attr_reader :name, :opts, :block def initialize(name, opts={}, &block) @name, @opts, @block = name, opts, block end def build(*args) ...
true
a890d314e4b3b8cdc54f31171ab24d5739aabb8f
Ruby
bharget/apple-news-rb
/lib/apple-news/security.rb
UTF-8
1,143
2.6875
3
[ "MIT" ]
permissive
require 'base64' require 'openssl' module AppleNewsClient class Security attr_accessor :method, :url, :content_type, :content_body def initialize(method, url, config = AppleNewsClient.config) @method = method.upcase @url = url @config = config @date = Time.now.utc.strftime("%Y-%m-%dT...
true
e734a0641713ffb1cf6ffbeb1e65a373b499a9ca
Ruby
atamproductions/foscam-ruby
/lib/foscam/model/network.rb
UTF-8
669
2.640625
3
[ "MIT" ]
permissive
module Foscam module Model class Network attr_accessor :ip, :mask, :gateway, :dns, :port def initialize(args = {}) [:port].each do |field| self.instance_variable_set("@#{field}".to_sym, args[field].to_i) unless args[field].nil? end [:ip, :mask, :gateway, :dns].each do |...
true
410d674db7abc9523f9aafef7b345be5f4955230
Ruby
cipherjai/heatUp_ruby
/ex_32.rb
UTF-8
811
4.15625
4
[]
no_license
the_count = [1,2,3,4,5] fruits = ['apples','oranges','pears','apricots'] change = [1, 'pennies', 2, 'dimes', 3, 'quarters'] # array without a type ? # mixed type array ???? possible ? # why does it shows kernel while typing put command #for number in the_count the_count.each do |number| puts "This is count #{numb...
true
f4e46bd0bd19463895792c2ffcb9b43dd0734cb6
Ruby
notryanb/ruby_snake
/test/test_player.rb
UTF-8
488
2.65625
3
[]
no_license
require 'minitest/autorun' Dir["./src/models/*"].each {|file| require file } class PlayerTest < Minitest::Test def setup @player = Player.new(30,30) end def test_player_symbol assert_equal 'X', @player.to_s end def test_getters assert_equal 30, @player.x assert_equal 30, @player.y asser...
true
455fe0400f41bf6a59889ef132ee2163ecb03e92
Ruby
brandyaustinseattle/api-exercise-seven-wonders
/seven_wonders.rb
UTF-8
1,415
3.546875
4
[]
no_license
require 'pry' require 'httparty' class Place attr_accessor :name def initialize(name) @name = name end def get_info encoded_uri = URI.encode("https://maps.googleapis.com/maps/api/place/textsearch/json?query=#{@name}&language=en&key=AIzaSyCBNp7R2Yc2-bgjqhMoCdGXAy7Y8Ndd3v4") HTTParty.get(encoded_uri...
true
ab8b624eb2bc6179a0547a855584d2bd5c3f1a64
Ruby
flowkater/StudyLog
/ProjectEuler_KR/prob_22/Ruby/flowkater/spec/name_score_spec.rb
UTF-8
424
2.5625
3
[]
no_license
require 'name_score' require 'spec_helper' describe "NameScore" do let(:ns){NameScore.new} describe "file test" do it "file test" do ns.names[0].should == "AARON" ns.names[5162].should == "ZULMA" ns.names.length.should == 5163 end it "name score" do ns.score["A"].should == 1 ns.score["Z"].shou...
true
e52d3ab766b29ed02a93f95fcec0b03307e913f0
Ruby
yogo/sapphire
/lib/yogo/project_ext.rb
UTF-8
3,491
2.515625
3
[]
no_license
require 'yogo/project' module Yogo class Project property :record_count, Integer has n, :memberships, :model=>"Membership" alias :members :memberships alias :collections :data_collections #make a new collection with schema from CSV file def collection_from_file(name, new_file, coll...
true
d89692b91a5b738cc037b40aa98cb254744d7f33
Ruby
koheiyamada/jenkins_test
/app/models/document_camera.rb
UTF-8
437
2.5625
3
[]
no_license
class DocumentCamera < ActiveRecord::Base class << self def created_on(date) where(created_at: date.to_time.all_day) end def of_month(month) where(created_at: month.to_time.all_month) end def of_year(year) where(created_at: Date.new(year).to_time.all_year) end end belo...
true
f6e18b7a761b72d0e44a4b9170695f7f3262c1fb
Ruby
mohammadaliawan/ginni_rb120_rb129
/exercises/oo_basics_inheritance/07.rb
UTF-8
611
3.9375
4
[]
no_license
=begin - Determine the lookup path used when invoking `cat1.color` - Only list the classes checked by Ruby when searching for #color =end class Animal attr_reader :color def initialize(color) @color = color end end class Cat < Animal end class Bird < Animal end cat1 = Cat.new('Black') cat1.color puts Ca...
true
190fd4eaabfb350fc91df42d5d870deccfc3f8ab
Ruby
james-wickman/wdiAssignments
/sinatra/activerecord_forms/app.rb
UTF-8
948
2.546875
3
[]
no_license
require 'sinatra' require 'sinatra/activerecord' require './models' require 'bundler/setup' require 'sinatra/flash' set :database, 'sqlite3:winter.sqlite3' set :sessions, true def current_user if session[:user_id] User.find(session[:user_id]) end end get "/" do @user = User.new erb :home end get "/user" ...
true
b3fb44133eabaa750b0c6fa6eb86cfa2802f1ce9
Ruby
alexfarrill/auto_cron
/lib/auto_cron.rb
UTF-8
2,032
2.71875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'auto_cron/railtie' if defined?(Rails) class AutoCron def initialize( templates, application ) require 'erb' @auto_cron_dir = ENV["CONFIG_AUTO_CRON"] @templates = templates.split(",") @application = application end def updated_crontab # Check for unopened or unclosed identifier block...
true
111718754c744c9b8821073d282f876a7f4fcce0
Ruby
gabriel-wilkes/Launch-School-Exercises
/101/lesson-6/twenty_one.rb
UTF-8
3,319
3.84375
4
[]
no_license
GAME_GOAL = 31 COMP_HIT_UNTIL = 27 def init_deck { '2' => 4, '3' => 4, '4' => 4, '5' => 4, '6' => 4, '7' => 4, '8' => 4, '9' => 4, '10' => 4, 'Jack' => 4, 'Queen' => 4, 'King' => 4, 'Ace' => 4 } end def prompt(msg) puts "☞ #{msg}" end def hand_value(hand) value = 0 ace_count = 0 hand.each do |card| ...
true
cf5dda40b5e152d613edb8e882fcd59cb8a8ce2f
Ruby
thiagocifani/gosu_example
/bullet.rb
UTF-8
564
3.25
3
[]
no_license
class Bullet attr_reader :x, :y, :alive def initialize(window) @window = window @image = Gosu::Image.new(@window, "media/bullet.png", true) @y = -rand(1000) @x = rand(@window.width) @alive = true end def update(laser) @y = @y + 5 if @y > @window.width @y = 0 ...
true
33144b1442417f61c57f486e4cf073e96f473591
Ruby
KoanHealth/go_cart
/lib/go_cart/format_file_writer.rb
UTF-8
1,337
2.6875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'erb' module GoCart class FormatFileWriter attr_accessor :template_directory, :module_name, :class_name def initialize(template_directory) @template_directory = template_directory end def write(formats, schemas, filename = nil, options = {}) @module_name = options[:module_name] || "MyModule" if @mod...
true
3faa7b9aa3970fcc349c96094bb725bbc64ca390
Ruby
viniavancii/TreinamentoRuby
/lib/curso/Login.rb
UTF-8
411
3.265625
3
[]
no_license
class Login attr_accessor :user, :senha #metodo com atributos def credenciais #inciar metodo em minusculo "Usuário:#{@user} e Senha:#{@senha}" #metodo virtual. Esse modo de #{} é uma forma de concatenação de variavel dentro de uma string end end login = Login.new login.user = "Vinici...
true
4af4cbf0402e0f1dba51bf028e1bcfdee72a985b
Ruby
liaowow/ruby-oo-practice-relationships-silicon-valley-exercise-dumbo-web-120919
/app/models/funding_round.rb
UTF-8
598
3.0625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class FundingRound attr_reader :startup, :venture_capitalist attr_accessor :type, :invest_amount @@all = [] def initialize(startup, venture_capitalist, type, invest_amount) @startup = startup @venture_capitalist = venture_capitalist @type = type @invest_amount = invest...
true
cf9d06b846cc6298d6069adc503b1e49443fc803
Ruby
sylantyev/adam
/src/app/controllers/jruby_interactive_controller.rb
UTF-8
1,750
2.578125
3
[]
no_license
# Copyright:: (c) Kubris & Autotelik Media Ltd 2008 # Author :: Tom Statter # Date :: April 2009 # License:: MIT ? # require 'jruby_interactive_view' class JRubyInteractiveController < ApplicationController set_view 'JRubyInteractiveView' set_close_action :close def load( parent ) @parent = se...
true
2bbf6bf16eb11365e590054c51c974ea07a033e2
Ruby
J-Y/RubyQuiz
/ruby_quiz/quiz120_sols/solutions/Jesse Merriman/state_graph.rb
UTF-8
4,975
3.46875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # state_graph.rb # Ruby Quiz 120: Magic Fingers require 'constants' require 'outcome' require 'state' require 'set' class Set # Get an object in the Set which equals (by ==) obj. def get(obj) find { |x| x == obj } end end # Represents a tree of States in parent-child relationships. clas...
true
e6f1b1b82b0762558c5e2795e80265b09ac4a4ae
Ruby
kken339039/leetcode-club
/Ruby/topic_168_excel_sheet_title.rb
UTF-8
294
3.5625
4
[]
no_license
# @param {Integer} n # @return {String} def convert_to_title(n) return "" if n <= 0 num = n + 64 if num > 64 && num < 91 return num.chr else r = n%26 > 0 ? (n%26) : (n%26)+26 l = n%26 > 0 ? (n/26) : (n/26-1) return convert_to_title(l) + convert_to_title(r) end end
true
62dcf03daecab276e29dbeb121e16b97957eb9b1
Ruby
mike-linshi/prime-ruby-001
/prime.rb
UTF-8
254
3.515625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Add code here! # prime?() returns true for prime numbers def prime?(num) # for i in 1..num, ensure num % i != 0 for i in 2..(num-1) remainder = num % i if remainder == 0 return false break end end return true end
true
aaa64262f06047bf4141be77e122d4e9ac972cae
Ruby
terrymorgan/Project-Euler
/P2-SumOfEvenFibs.rb
UTF-8
301
3.8125
4
[]
no_license
#Project Euler - Sum of even Fibs < 4,000,000 prev2=1 prev1=1 current=prev2+prev1 sum=0 while current < 4000000 if current % 2 === 0 sum = sum + current end prev2 = prev1 prev1 = current current = prev2 + prev1 end puts "The sum of all even Fibonacci numbers less than 4,000,000 is #{sum}"
true
13a3404df44cc58965d28a6245b3bb53dd37d487
Ruby
elyhess/adopt_dont_shop
/spec/models/shelter_spec.rb
UTF-8
2,720
2.53125
3
[]
no_license
require "rails_helper" describe Shelter, type: :model do describe "relationships" do it { should have_many(:pets).dependent(:destroy) } end describe "Class Methods" do before :each do @shelter1 = Shelter.create!(name: "A", address: "123 Shady Ave", city: "Denver", state: "CO", zip: 80011) @s...
true
7e9339cf44f364ef60782bc6454d9c9c477b26c3
Ruby
jutonz/tlapse
/lib/tlapse/config.rb
UTF-8
3,253
2.796875
3
[ "MIT" ]
permissive
require "yaml" require "fileutils" require "tlapse/errors" require "active_support/time_with_zone" module Tlapse class Config Validation = Struct.new :method, :error CONFIG_OPTIONS = { "lat" => { default: 35.779590, desc: "Your current latitude", type: :float }, "lo...
true
26e16e30e3bfc9aeaa77c088ec2add01457ba275
Ruby
MinBK/feedprocessor
/feed_aggregator.rb
UTF-8
474
2.9375
3
[]
no_license
require_relative 'config/initializers' require_relative 'db/macleans_rss_feeds' # get input from user puts "Please provide the url from which you want to scrap items" url = gets begin scrap_items = Scrapper.scrap(url) # save scrap items to db rss_feed = MacleansRssFeed.new(url: url, data: scrap_items) if rss...
true
070bd8200df652c341d96f1e2cc9d6075872c38d
Ruby
juandigt/MarsRover
/spec/direction_spec.rb
UTF-8
1,653
3.3125
3
[]
no_license
require_relative "../lib/direction" describe "Direction" do it "Has a direction North" do d = Direction.new('N') expect(d.north?).to be(true) end it "Has a direction South" do d = Direction.new('S') expect(d.south?).to be(true) end it "Has a direction East" do d = Direction.new('E') ...
true
667d20eae2c8363e2880fb5d85bc53cdc634ff47
Ruby
timothydowd/substrings
/substrings.rb
UTF-8
684
4.46875
4
[]
no_license
#Implement a method #substrings that takes a word as the first argument and then an array of valid substrings (your dictionary) as the second argument. It should return a hash listing each substring (case insensitive) that was found in the original string and how many times it was found. #Make sure your method can han...
true
20e94904f9453f488bd1d9fc2e467cdf10384fdd
Ruby
AlexJeng/challenges
/ruby/anagram/lib/app.rb
UTF-8
410
2.65625
3
[]
no_license
require "sinatra" require "sinatra/json" require_relative "anagram" class App < Sinatra::Base helpers Sinatra::JSON get "/:words" do |words| json anagram.call(words.split(",")) end private def anagram @anagram ||= Anagram.new(:wordlist => wordlist_from_file) end def wordlist_from_file Fil...
true
cd3a73a34d20d048740534c9c067563f058fdb0a
Ruby
learnstream/ls_atomic
/app/helpers/lessons_helper.rb
UTF-8
152
2.71875
3
[]
no_license
module LessonsHelper def fitName(lesson) name = lesson.name if (name.length > 20) name = name[0..17] + "..." end name end end
true
8ee0ac5855909909669f25f58444358897a2b750
Ruby
elizabrock/student_picker
/app/models/student.rb
UTF-8
419
2.515625
3
[ "MIT" ]
permissive
class Student < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name default_scope ->{ order("last_called_at ASC NULLS FIRST") } scope :eligible_to_be_called, ->{ where("last_called_at <= ? or last_called_at IS NULL", 24.hours.ago) } def self.pick! student = Student.eligible_to_b...
true
d4417d2dc3bb5b2cd6009b5a92b9963c6ea63472
Ruby
chef/license_scout
/spec/fixtures/bundler_2x_gems_dir/gems/builder-3.2.3/test/test_markupbuilder.rb
UTF-8
16,144
2.84375
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "CC0-1.0", "LicenseRef-scancode-free-unknown", "MIT" ]
permissive
#!/usr/bin/env ruby #-- # Portions copyright 2004 by Jim Weirich (jim@weirichhouse.org). # Portions copyright 2005 by Sam Ruby (rubys@intertwingly.net). # All rights reserved. # Permission is granted for use, copying, modification, distribution, # and distribution of modified versions of this work as long as the # ab...
true
838e09044191b516a9265ca410285ecdcc619146
Ruby
enemycnt/telegram_delivery
/lib/telegram_bot/client.rb
UTF-8
2,442
3.078125
3
[]
no_license
require 'telegram/bot' require_relative 'commands' module TelegramBot class Client TOKEN = '217512949:AAFj98AjW3b97PD77Wyp7EGrqyfRQFYvLDs' class << self def client @client ||= Telegram::Bot::Client.new(TOKEN) end def listen puts "listening longpooling" @user ...
true
77fe169533c011fde179edd905a4971fc907d69c
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/cs169/800/feature_try/method_source/16781.rb
UTF-8
170
3.1875
3
[]
no_license
def combine_anagrams(words) groups = Hash.new([]) words.each do |w| ww = w.downcase.chars.to_a.sort.to_s groups[ww] += [w] end groups.map { |k, v| v } end
true
c4fb7636266ce06e03ad869c8ae51e88dc693b12
Ruby
skillhound/frisky
/lib/frisky/lock.rb
UTF-8
779
2.578125
3
[]
no_license
module Frisky module Lock class << self def locked?(key) Frisky.redis.exists key end def lock?(key, expiration=60) a = Frisky.redis.setnx(key, true) Frisky.redis.expire(key, expiration) if a a end def block(key, expiration=60) $statsd.time("p...
true
c05d38cb5369f07c6fd27c06c5e37a01ff54db76
Ruby
twang333/leetcode
/11_max_area/max_area.rb
UTF-8
417
3.609375
4
[]
no_license
def max_area(height) return 0 if height.size < 2 left = 0 right = height.size - 1 area = 0 while left < right area = [area, calculate_area(left, right, height[left], height[right])].max if height[left] <= height[right] left += 1 else right -= 1 end end area end def calculate_area(left, right, le...
true
b2244f5af6c2e14e239d988b3ce99ce30bff5034
Ruby
timuruski/rosalind-rb
/test/test_phenotype.rb
UTF-8
1,444
2.984375
3
[]
no_license
require 'contest' require 'phenotype' class TestPhenotype < Test::Unit::TestCase describe "Phenotype#dominant_expression" do test "calculating probability of dominant expression" do subject = Phenotype.new(2, 2, 2) probability = 0.78333 assert_equal probability, subject.dominant_expression.roun...
true
1db5f718a51ac7bd77275c20c7747ae2e85c8ae1
Ruby
JuanitoFatas/bake
/lib/bake/context.rb
UTF-8
2,629
2.703125
3
[ "MIT" ]
permissive
# Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to us...
true
b371be269ceb020187397975522f3736cd167f6b
Ruby
sokampdx/hackerrank
/algorithms/cut_the_sticks.rb
UTF-8
276
3.09375
3
[]
no_license
#!/usr/bin/ruby def find_remain(remain) return if remain.empty? puts remain.size min = remain.min current = remain.map { |x| x - min }.reject { |x| x == 0 } find_remain(current) end num = gets.chomp.to_i sticks = gets.strip.split(" ").map(&:to_i) find_remain(sticks)
true
0973670970ef0832124d320f68a9caf62c2988a4
Ruby
koolkt/tictactoe_ruby
/bin/Engine.rb
UTF-8
1,011
3.765625
4
[]
no_license
require_relative 'Human.rb' require_relative 'Robot.rb' require_relative 'Logic.rb' class Engine def initialize(b,r) @board = b @graphics = r @logic = Logic.new() end def run() player1_name = ask_name() @player1 = Human.new(player1_name) @player2 = Robot.new("Robot", @logic) current ...
true
ba4eacc79e50024ab297c51093c655523311dc30
Ruby
david-azevedo/advent-of-code-2020
/src/day17_wicked_fast_solution.rb
UTF-8
2,599
3.484375
3
[]
no_license
# frozen_string_literal: true require 'set' lines = File.readlines("../data/#{__FILE__[0..4]}.txt") # Only the positions of the active cubes are relevant active_3d = Set.new active_4d = Set.new lines.each_with_index do |line, row| line.split('').each_with_index do |char, col| active_3d.add([row, col, 0]) if c...
true
e0317b0b2ae4d367705ce1ad516fb0ac882455e8
Ruby
sal1n/sanguine
/lib/sanguine/handy_methods.rb
UTF-8
461
2.71875
3
[]
no_license
module Sanguine # a collection of handy methods. # module HandyMethods def window GameWindow.instance end def keys self.window.keys end def game self.window.game end def messages self.game.messages end def player self.game.p...
true
ce6724b21345ea298b80b35d91028b3b89e6260f
Ruby
zbunde/dota-sinatra
/lib/hero_repository.rb
UTF-8
424
2.6875
3
[]
no_license
class HeroRepository def initialize(db) @db = db[:heroes] end def index @db.all end def create(hero) @db.insert(hero) end def show(id) @db[:id => id] end def find_name(id) @db[:id => id][:name] end def all_names @db.select(:name).to_a end def update(id, attributes) ...
true
72219c680a3d0caa6c732e7c9bc53d3d5405964e
Ruby
amittiwari123/practise
/simpleinterest.rb
UTF-8
316
3.390625
3
[]
no_license
class Simple_Interest def initialize(p,r,t) @principal = p @rate = r @time = t end def calculate_simple_interest simple_interest = @principal*@rate*@time/100 end end a1 = Simple_Interest.new(1000,10,5) a1.calculate_simple_interest puts a1.calculate_simple_interest
true
989c03155f98e78a25fbf315beb3a5875d8b97f6
Ruby
mn113/codewars-solutions
/ruby/resistorvalues.rb
UTF-8
942
3.390625
3
[]
no_license
def decode_resistor_colors(bandstr) band_key = ['black','brown','red','orange','yellow','green','blue','violet','gray','white'] # Process input: bands = bandstr.split(' ') values = bands.map do |x| band_key.find_index(x) end # Combine numbers into total resistance: onetwo = (values[0].to_s + values[1].to_s)....
true
be2f172086ef63ecf2408d43183a9fa87417024b
Ruby
kevin-kientopp/top-down-shooter
/test/test_window.rb
UTF-8
1,889
2.765625
3
[]
no_license
require 'minitest/autorun' require 'top_down_shooter/window' require 'gosu' class TestWindow < Minitest::Test def test_shoot_gun_up window = Window.new window.sounds_enabled = false window.button_down Gosu::KbSpace assert_equal(1, window.bullets.size) assert_equal(window.player.x - 5,...
true
c1878097c5d362544591e0c872aedc437216a2b3
Ruby
archan937/magnum-pi
/test/unit/gem_ext/test_aj.rb
UTF-8
3,537
2.6875
3
[ "MIT" ]
permissive
require_relative "../../test_helper" module Unit class TestAj < MiniTest::Test describe Aj do before do @json = <<-JSON { "data": { "articles": [ { "title": "MagnumPI is awesome!!!", "category": "ruby" ...
true
a4660940136a76a8a95aecc8d7d69911c560a391
Ruby
EGI-FCTF/rOCCI-core
/lib/occi/core/helpers/instance_attributes_accessor.rb
UTF-8
775
2.71875
3
[ "Apache-2.0" ]
permissive
module Occi module Core module Helpers # Introduces instance attributes accessor as a shortcut to # getting to the `attributes` values inside the receiver. # # @author Boris Parak <parak@cesnet.cz> module InstanceAttributesAccessor # :nodoc: def [](key) attr...
true
e541a1294782b75807795555f3084b1b9db1ae82
Ruby
smsheik1/hamburgler_repo
/hash1..rb
UTF-8
2,553
3.640625
4
[]
no_license
class Vehicle def initialize(gas_economy,mileage,condition,carfax_score,oil_health,tire_health) @gas_economy = gas_economy @mileage = mileage @condition = condition @carfax_score = carfax_score @oil_health = oil_health @tire_health = tire_health self end def oil_change @oil_health = 100 puts 'you ...
true
520a7e0bd016611a1f790a78c0684b6623efcad3
Ruby
callumpb/Budgeting-app-project1-ruby-sql-
/controllers/transactions_controller.rb
UTF-8
910
2.515625
3
[]
no_license
require('sinatra') require('sinatra/contrib/all') require('pry') require_relative('../models/transaction.rb') require_relative('../models/tag.rb') require_relative('../models/merchant.rb') get '/transactions' do @transactions = Transaction.all @total = Transaction.total_spend @merchants = Merchant.all @tags = ...
true
e5578c582bb49ca2bd2381d805fa73d4230b36df
Ruby
sethuster/gridium
/lib/element_extensions.rb
UTF-8
3,062
2.59375
3
[ "MIT" ]
permissive
include Gridium class Gridium::ElementExtensions class << self def highlight(element) Log.debug("[GRIDIUM::ElementExtensions] Highlighting element...") original_border = Driver.execute_script("return arguments[0].style.border", element.element) original_background = Driver.execute_script("retur...
true
af4c250d55e6773ff4d5a79bc99412238886b273
Ruby
kkirsche/rubygems_api
/test/rubygems_api/utilities_spec.rb
UTF-8
1,570
2.515625
3
[ "MIT" ]
permissive
require 'minitest_helper' module TestRubygemsAPI # Test general gem requirements class TestRubygems describe 'Rubygems API Utilities', 'General gem tests' do it 'should return true if format is JSON or YAML' do client = Rubygems::API::Client.new response = client.validate_format('json') ...
true
c41428750b634a7f2f7be5a0b43af89624a911e9
Ruby
piotrmurach/lex
/lib/lex/state.rb
UTF-8
631
3.234375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# frozen_string_literal: true module Lex class State include Enumerable attr_reader :name, :lexemes def initialize(name, lexemes = []) @name = name @lexemes = lexemes end def each(&block) @lexemes.each(&block) end def <<(lexeme) @lexemes << lexeme end ...
true
a7bcee645f88fcec84343457c099da4908ad1028
Ruby
clberry7107/rcc
/app/models/fan.rb
UTF-8
289
2.515625
3
[]
no_license
class Fan < ActiveRecord::Base before_validation do self.f_name.capitalize! self.l_name.capitalize! end validates :email, uniqueness: true validates :f_name, :l_name, :email, presence: true def full_name return "#{self.f_name} #{self.l_name}" end end
true
8951e8d38218b1586fed05c394013d82dbde2900
Ruby
empeje/tdd-playground
/test/is_2_power_n_test.rb
UTF-8
590
2.828125
3
[]
no_license
require "minitest/autorun" require_relative "../src/is_2_power_n" class TwoPowerNTest < Minitest::Test def test_can_check_8 two_power_n = TwoPowerN.is_true(8) assert_equal true, two_power_n end def test_can_check_6 two_power_n = TwoPowerN.is_true(6) # 2^2 = 4 # 2^3 = 8 assert_equal false...
true
2977e9c8685b4f0cc55b3fbc892891bf585ed3b3
Ruby
farmerchuk/companion_workbook
/easy_quiz2.rb
UTF-8
1,271
3.59375
4
[]
no_license
# easy_quiz2.rb # 1. ages = { "Herman" => 32, "Lily" => 30, "Grandpa" => 402, "Eddie" => 10 } puts ages.key?("Spot") # 2. ages = { "Herman" => 32, "Lily" => 30, "Grandpa" => 5843, "Eddie" => 10, "Marilyn" => 22, "Spot" => 237 } puts ages.values.inject(:+) # 3. ages = { "Herman" => 32, "Lily" => 30, "Grandpa" => 402,...
true
866ac59435482ff4682a9232a2b876e6357b45f6
Ruby
rbotafogo/galaaz
/examples/misc/moneyball.rb
UTF-8
957
3.109375
3
[ "BSD-2-Clause" ]
permissive
# coding: utf-8 require 'galaaz' local_dir = File.expand_path File.dirname(__FILE__) # This dataset comes from Baseball-Reference.com. baseball = R.read__csv("#{local_dir}/baseball.csv") # Lets look at the data available for Momeyball. moneyball = baseball.subset(baseball.Year < 2002) # Let's see if we can predict...
true
7caee4a47fe4888b5dbde12f15f305662b2bf950
Ruby
kyleskin/ruby_tests
/lib/integers.rb
UTF-8
870
3.90625
4
[]
no_license
#! usr/bin/env ruby class Integers def change_to_integer(number) number.to_i end def character(number) number.chr end def down_to(int, limit) int.downto(limit){ |n| n } end def is_even(int) int.even? end def greatest_common_divisor(int1, int2) int1.gcd(int2) end def gcd_l...
true
1a404f8b7f4fada5f6111e5cf43fc1191bca17b7
Ruby
tellis9397/tv_helper
/app/services/show_search.rb
UTF-8
1,715
2.96875
3
[]
no_license
require 'net/http' require 'json' class ShowSearch class << self def get_new_show(title, current_episode = 1, current_season = 1, options = {}) json = get_json(title) show_title = json[:title] plot = json[:plot] total_seasons = json[:totalseasons] recent_season = most_recent_season(show_t...
true
d20e6fae7afcbcd43657f6c0abed940009d45361
Ruby
tullur/mampf
/spec/models/chapter_spec.rb
UTF-8
2,369
2.640625
3
[ "MIT" ]
permissive
require 'rails_helper' RSpec.describe Chapter, type: :model do it 'has a valid factory' do expect(FactoryBot.build(:chapter)).to be_valid end it 'has a valid factory for including sections' do expect(FactoryBot.build(:chapter, :with_sections)).to be_valid end it 'is invalid without a title' do ch...
true
dc84ee6d5b3bcd9b9e40f659e4513e0766a96e09
Ruby
sngeth/project_euler
/16.rb
UTF-8
339
3.296875
3
[]
no_license
require "minitest/autorun" # 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. # What is the sum of the digits of the number 2^1000? class ProjectEulerTests < Minitest::Test def power_digit_sum (2**1000).to_s.chars.map(&:to_i).reduce(:+) end def test_power_digit_sum assert 1366, power_d...
true
d98108ac3e085fe567d021536cf0036190568e09
Ruby
Tolvic/oystercard-challenge
/spec/oyster_spec.rb
UTF-8
2,238
3.03125
3
[]
no_license
require 'oyster.rb' describe Oyster do let(:station){ double :station, :touch_in => true, :touch_out => true } describe '#check_balance' do it 'return balance when customer calls check_balance method' do expect(subject.check_balance).to eq 0 end it 'add_credit increments balance on the card b...
true
3a3261a118d79ff0492c8ac22b7388a3b89fbbb6
Ruby
chameis123/mined-minds-kapa-
/test.rb
UTF-8
45
3.03125
3
[]
no_license
(1..10).each { |i| puts i } puts "1" * 10
true
94830662f42396e1a252af8679dbd7d57616bb99
Ruby
msimon42/mid_mod
/app/models/member.rb
UTF-8
216
2.859375
3
[]
no_license
class Member attr_reader :name, :role, :house, :patronus, :id def initialize(name, role, house, patronus, id) @name = name @role = role @house = house @patronus = patronus @id = id end end
true
ff04b025f6fec00ed32d25307ad436a4fa364364
Ruby
janejanejane/job_board
/app/models/vote.rb
UTF-8
920
2.546875
3
[]
no_license
# == Schema Information # # Table name: votes # # id :integer not null, primary key # user_id :integer # job_preference :integer # user_voted :integer # created_at :datetime not null # updated_at :datetime not null # class Vote < ActiveRecord::Base def sel...
true
9bb3fb1c8d4a00aed172f46b8dcfce66ba279d86
Ruby
michaeltchapman/puppet-orchestration_utils
/lib/puppet/type/consul_kv.rb
UTF-8
817
2.671875
3
[ "Apache-2.0" ]
permissive
Puppet::Type.newtype(:consul_kv) do @doc = <<-'EOD' Consul Key/value pair operations (Create, change, delete). e.g Add a key/value pair or change value of a key consul_kv{'foo/bar': value => 'baz'} Above code will create a key in consul named 'foo/bar' with value 'baz' if it doesn't exist. If the key exi...
true
8671b5832ed6f6c98d8c1cd3075a11af600e8016
Ruby
Mervodactyl/bejeweled
/learn_to_programme/loops/bottles_complete.rb
UTF-8
793
4.1875
4
[]
no_license
puts "How many bottles of beer shall we sing?" bottle_count = gets.chomp.to_i while bottle_count > 1 puts "#{bottle_count} bottles of beer on the wall!" puts "#{bottle_count} bottles of beer!!!" puts "You take one down," puts "You pass it around!!!" bottle_count -= 1 if bottle_count == 1 ...
true
8d679821ec0f4954a026dd5466dcf82b7ea65600
Ruby
GregSantulli/balance
/app/models/group.rb
UTF-8
851
2.828125
3
[]
no_license
class Group < ActiveRecord::Base has_many :expenses has_many :memberships has_many :users, through: :memberships validates :name, presence: true def user_balance_hash expense_hash = {} even_split = even_split_amount self.users.each do |user| expense_hash[user.first_name] = even_split - ou...
true
a79ccd398a3602f09f4524f46282033ac353b71b
Ruby
mkristian/slf4r
/slf4r-gem/lib/slf4r/log4r_logger.rb
UTF-8
829
2.515625
3
[ "MIT" ]
permissive
require 'log4r' require 'slf4r/abstract_logger' module Slf4r class Logger < AbstractLogger attr_reader :logger def initialize(name) super @logger = ::Log4r::Logger::Repository[name] || ::Log4r::Logger.new(name) end public def debug? @logger.level == Log4r::DEBUG end ...
true
3a6d5cb3ed1f380b105f3c1d692fe5061fb2d2a1
Ruby
mhpjay422/cwars
/Ruby/5_Kyu/sum_of_paris.rb
UTF-8
2,372
3.84375
4
[]
no_license
# Sum of Pairs # Given a list of integers and a single sum value, return the first two values (parse from the left please) in order of appearance that add up to form the sum. # sum_pairs([11, 3, 7, 5], 10) # # ^--^ 3 + 7 = 10 # == [3, 7] # sum_pairs([4, 3, 2, 3, 4], 6) # # ^...
true
a81b78ecf1f4e654b70d106136a45a10b3d4926a
Ruby
vcavallo/awkshun
/app/models/item.rb
UTF-8
1,037
2.609375
3
[]
no_license
class Item < ActiveRecord::Base validates :name, presence: true, uniqueness: true validates :reserved_price, presence: true, numericality: { greater_than_or_equal_to: 1 } belongs_to :auction def mark_sold self.update(already_sold: true) end def self.status_by_name(item_name) item ...
true
21805e866a130a3348be3d0d69c2e31e6d45f662
Ruby
moonmaster9000/dupe
/spec/lib_specs/string_spec.rb
UTF-8
769
2.8125
3
[]
no_license
require 'spec_helper' describe String do describe "plural?" do it "should report plural symbols as plural" do 'apples'.plural?.should == true 'apple'.plural?.should == false end end describe "singular?" do it "should report singular items as singular" do 'apples'.singular?.shoul...
true
393e07b99a91d0769599db09ab3a807e99e3e0ec
Ruby
richard020389/ga
/app/models/user.rb
UTF-8
1,134
2.640625
3
[]
no_license
class User < ApplicationRecord after_initialize :default_values validates_uniqueness_of :name has_many :battles,:dependent => :destroy User_init_point = 10 User_lvl_point = 2 User_lvl_exp = 2000 attr_accessor :trig def lvl_up if self.exp >= User_lvl_exp self.exp -= User_lvl_exp self.lvl...
true
4f7b0085b0bf5c0084c96114a864451b05b459dc
Ruby
MagneticRegulus/101_exercises
/medium_2/5_triangle_sides.rb
UTF-8
1,203
4.40625
4
[]
no_license
# A triangle is classified as follows: # equilateral - All 3 sides are of equal length # isosceles - 2 sides are of equal length, while the 3rd is different # scalene - All 3 sides are of different length # To be a valid triangle, the sum of the lengths of the two shortest sides must # be greater than the length of t...
true
e52446b687174188db3a04f378342968db4f8c78
Ruby
ahawkins/hn-whos-hiring
/test/thread_finder_test.rb
UTF-8
1,091
2.65625
3
[]
no_license
require_relative 'test_helper' class ThreadFinderTest < MiniTest::Test def stub_items(ids) stub_request(:get, "https://hacker-news.firebaseio.com/v0/user/whoishiring.json").to_return({ body: JSON.dump({ submitted: ids }), status: 200 }) end def stub_item(item, data) stub_reque...
true
6ce910c72fbdcd3c38a66dd91ccb51aba3b4c83f
Ruby
sehajtaneja1/test1
/montanacycling-master/app/helpers/table_helper.rb
UTF-8
2,672
2.625
3
[ "MIT" ]
permissive
module TableHelper def table(collection_symbol = controller.controller_name.to_sym, options = {}, &block) table = Table.new(collection_symbol, options[:collection] || assigns[collection_symbol.to_s], options) yield(table) if block table.sort! render(:partial => "table/base", :locals => { :table => tab...
true
9d6d9d109a97a21006045128be4b63fa09f78c81
Ruby
vidoseaver/black_thursday
/test/invoice_repository_test.rb
UTF-8
2,954
2.796875
3
[]
no_license
require './test/test_helper' require_relative "../lib/invoice_repository" require_relative "../lib/sales_engine" require 'csv' class InvoiceRepositoryTest < MiniTest::Test attr_reader :invoice_repository def setup @se = SalesEngine.from_csv({ :items => "./data/items.csv", :merch...
true
0c4cf4b95bfecedd888989ac0ccc72170c594bae
Ruby
klueless-io/sample_cmdlet_patterns
/lib/sample_cmdlet_patterns/commands/table_padding.rb
UTF-8
770
2.734375
3
[ "MIT" ]
permissive
# frozen_string_literal: true require_relative '../command' require 'tty-config' require 'tty-prompt' module SampleCmdletPatterns module Commands # Columan padding class TablePadding < SampleCmdletPatterns::Command def initialize(options) @options = options end # Execute TablePad...
true
b23614b4eaf28edfaa2134d21d071ebc5f2f3186
Ruby
TheBryant/mtgo
/googledocs.rb
UTF-8
1,078
2.640625
3
[]
no_license
require 'open-uri' require 'nokogiri' require 'openssl' OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE def gdocs(uri='https://docs.google.com/spreadsheets/d/1YsO5FNi8_jcajFjiYuFJrmElT6lxDzDVhXS-FXyajF0/pubhtml') doc = Nokogiri::HTML(open(uri)) File.open("cardlist.txt", "w") { |f| doc.css('div table tbody tr...
true
0d5922df370382e30644d8464e14c244488ab70a
Ruby
yuguo/overlayrb
/app.rb
UTF-8
1,743
3.078125
3
[]
no_license
#!/usr/bin/ruby require "RMagick" require "Find" class Avatar # generate def self.go back_txt = 'back-color.txt' front_txt = 'front-color.txt' front_dir = 'front-image' front_files = self.findFiles(front_dir) i = 400000 File.open(back_txt, 'r').each_line do |back_color| File.open...
true
24a1e901b735a55f74e61599b7e2a98caeb274b3
Ruby
RobertsK284/ruby-mastery-learning-curriculum
/ch4/two_dice_game.rb
UTF-8
637
3.625
4
[]
no_license
my_score = 0 opponent_score = 0 while my_score == opponent_score do my_1st_die = rand(6) + 1 my_2nd_die = rand(6) + 1 my_score = my_1st_die + my_2nd_die opponent_1st_die = rand(6) + 1 opponent_2nd_die = rand(6) + 1 opponent_score = opponent_1st_die + opponent_2nd_die puts "I rolled a " + my_1st_die.to_s + " and a " + ...
true
029461e5a5fe6209215a27e288c57bd4b353bce1
Ruby
vbrazo/algorithms-archives
/strings/first_unique_character_in_a_string.rb
UTF-8
1,853
4.78125
5
[]
no_license
# Given a string, find the first non-repeating character in it = # and return its index. If it doesn't exist, return -1. # # Approach 1: Linear time solution (Hash map approach) # # The best possible solution here could be of a linear time # because to ensure that the character is unique you have to # check the whole...
true
880cc8d3face911746417fb70ebcf2cc9943d20b
Ruby
mcmillhj/PL0Compiler
/SyntaxTree/RangeNode.rb
UTF-8
331
3.234375
3
[]
no_license
class RangeNode < Node attr_reader :start, :end def initialize(startval, endval) super() @start = startval @end = endval end # todo def accept visitor @end.accept visitor if @end and @end.is_a? Node visitor.visit_range_node self end def to_s "Range -> #{@start}..#{@end}...
true
c3e2a3809877dfac4cb7ed00acd8b099227e5fce
Ruby
alfredorico/active_record-mti
/lib/active_record/mti/model_schema.rb
UTF-8
1,635
2.578125
3
[ "MIT" ]
permissive
module ActiveRecord module MTI module ModelSchema def self.prepended(base) base.extend(ClassMethods) end module ClassMethods # Computes and returns a table name according to default conventions. def compute_table_name if self != base_class # Nested...
true
c4f1dc94563fc0f70cff8eec8620a094d6f2391d
Ruby
allansene/hacker-scripts
/smack_my_bitch_up.rb
UTF-8
796
2.734375
3
[ "WTFPL" ]
permissive
#!/usr/bin/env ruby # Exit early if no sessions with my username are found exit unless `who -q`.include? ENV['USER'] require 'dotenv' require 'twilio-ruby' Dotenv.load TWILIO_ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID'] TWILIO_AUTH_TOKEN = ENV['TWILIO_AUTH_TOKEN'] @twilio = Twilio::REST::Client.new TWILIO_ACCOUNT_SID,...
true
e80c6c641fef45997ac18063cf9d8d22a91ea9f1
Ruby
Laurencarne/oo-relationships-practice-london-web-career-042219
/app/models/Lyft/Ride.rb
UTF-8
631
3.5
4
[]
no_license
class Ride @@all = [] attr_reader :name, :driver, :passenger, :distance def initialize(name, driver, passenger, distance) @name = name @driver = driver @passenger = passenger @distance = distance @@all << self end def self.all @@all end def passengers # returns the passe...
true
8daa0168b3fabaaa905099f3e50576d5197e27dd
Ruby
jajohnson85/AcademyPGH
/is_it_prime.rb
UTF-8
607
4.28125
4
[]
no_license
#class Prime_test prime = 1 def is_prime (number) for i in 2...number.to_i for j in 2...number.to_i if number.to_i % j == 0 prime = 0 end end end return prime end #FUNCTIONS^^^^ #MAIN PROGRAM VVVVV #number = Prime_test.new one = 1 while one == 1 puts "Enter a number and I'll tell yo...
true
158186bd2f6ee2e0a5c84c5f2e73dfb78fad652d
Ruby
samwich/advent_of_code_2020
/3/toboggan.rb
UTF-8
412
3.203125
3
[]
no_license
class Toboggan OPEN_SQUARE = '.' TREE_SQUARE = '#' def initialize (map_file_name, over, down) @snow_map = SnowMap.new(map_file_name) @over = over @down = down end def trees_encountered @snow_map.squares_on_slope(@over, @down).filter {|x| x == TREE_SQUARE}.length end def trees_encount...
true
1293311098ab80db725888a1f566ef0f6a7b8de6
Ruby
loris-fo/battleships
/lib/ship.rb
UTF-8
146
2.765625
3
[]
no_license
class Ship attr_reader :size def initialize @size = 1 @hits = 0 end def hit @hits += 1 end def sunk? @hits == size end end
true
988309df77debea636dcb47a5393aed9bee3ca8e
Ruby
pithyless/project-euler
/euler-ruby/euler_032.rb
UTF-8
887
3.234375
3
[]
no_license
class Array def each_permutation(&blockproc) a = [] self.each do |c| a.push(c) end n = a.length p = Array.new(n+1,0) i = 1 blockproc.call(a) while i < n do if p[i] < i j = 0 j = p[i] if (i % 2) == 1 t = a[j] a[j] = a[i] a[i] =...
true
1a9969692f3ef2c697c061f251150992627803c7
Ruby
Juanchote/traveler
/lib/traveler/traveler.rb
UTF-8
2,672
3.546875
4
[]
no_license
module Traveler @cities, @visited_cities = [], [] # Parses the given file and sets the starting city # [params] # * name => Name of the starting city # * url => Path of the cities file # [returns] # * @cities => Array of Cities def self.init_cities name, url begin @cities ...
true
850746e41aa296f01bc442dd9b3c313d056f4c24
Ruby
s11rikuya/ruby-perfect-lesson
/5-5-1-14.rb
UTF-8
52
3.03125
3
[]
no_license
array = [1,2,3,4,5] p array.partition {|n| n.even?}
true
a457634ccae9890786c2839b1407d641968e7208
Ruby
jessicatriana/ruby-oo-relationships-practice-recipes-exercise-austin-web-012720
/app/models/User.rb
UTF-8
170
2.75
3
[]
no_license
class User attr_reader :user_name @@all = [] def initialize(user_name) @user_name = user_name @@all << self end def self.all @@all end end
true
78ce092fe35488a8d20bbbd00bc04afe2e49493b
Ruby
cfanpnk/launchschool
/backend/ruby_foundations/exercises/ruby_basics/loops1/q6.rb
UTF-8
101
3.140625
3
[]
no_license
numbers = (0..99).to_a count = 0 while count += 1 puts numbers.sample break if count == 5 end
true
21cd91b0157cad2650bdcb7b3ac4fd43ffcde7ea
Ruby
znamenica/bukovina
/lib/bukovina/parsers/service_link.rb
UTF-8
6,390
2.671875
3
[ "MIT" ]
permissive
require 'uri' require 'rdoba' class Bukovina::Parsers::ServiceLink attr_reader :errors rdoba mixin: :split_by ALPHABETHS = { 'hip' => :цр, #церковнославянская разметка hip 'рп' => :рп, 'ро' => :ру, 'ру' => :ру, 'ан' => :ра, 'en' => :ра, 'гр' => :гр, 'ив' => :и...
true
62bbd1186ee71f56d2167ed1b871d5b7252ef8f0
Ruby
anye55/Launch-School
/intro/more_stuff/exe_one.rb
UTF-8
236
2.859375
3
[]
no_license
def has_a_lab?(word) if /lab/.match(word) puts word else puts "Sorry, no pattern match found" end end has_a_lab?("laboratory") has_a_lab?("experiment") has_a_lab?("Pans Labyrinth") has_a_lab?("elaborate") has_a_lab?("polar bear")
true