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
2d0a3b85b53fe3369c701b48babfcb1f385d7796
Ruby
Hyftar/Yellow-Pages-Addresses-Scraper
/main.rb
UTF-8
1,765
2.875
3
[]
no_license
require 'http' require 'nokogiri' require 'parallel' require 'json' require 'byebug' def get_max_page(uri) content = HTTP.get(uri).to_s Nokogiri::HTML(content).css('.pageCount > span:nth-child(2)').text.to_i end PROVINCES = [ 'Manitoba+MB', 'Alberta+AB', 'Saskatchewan+SK', 'British+Columbia+BC', 'Onta...
true
aa5d1610512f9eb006391d80d61efa26048d7bd6
Ruby
ismith/elevator_alerts
/authy.rb
UTF-8
1,456
2.765625
3
[ "MIT" ]
permissive
require 'faraday' require 'json' class Authy START_ENDPOINT = "https://api.authy.com/protected/json/phones/verification/start".freeze VERIFY_ENDPOINT = "https://api.authy.com/protected/json/phones/verification/check".freeze def self.submit_number(number) # Running locally, we may not care about actually ve...
true
c907343f17aead8ba92963cf6bacef2fa24e9b7a
Ruby
mostafahussein/complaint-system
/lib/tasks/sample_data.rake
UTF-8
3,725
2.546875
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
namespace :db do desc 'Fill database with sample data' task populate: :environment do Faker::Config.locale = :en make_employees_and_students # make_employees_and_students_as_users # attended_subjects # assign_advisors_to_subjects # make_complaints end end def make_employees_and_students ...
true
817318f8cca5844b8d03a73591e45c6a3b4bf84e
Ruby
arunjax/vim_diff
/lib/vim_diff.rb
UTF-8
682
2.578125
3
[]
no_license
require 'installer.rb' module VimDiff class Generator attr_accessor :left_file_path attr_accessor :right_file_path attr_accessor :html_diff_path def initialize(left_file_path, right_file_path, html_diff_path) self.left_file_path = left_file_path self.right_file_path = right_file_path ...
true
618707e0e78d5f08715d794acef5b8cfe66d37a6
Ruby
marylenec/my-select-houston-web-071618
/lib/my_select.rb
UTF-8
370
3.59375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
nums = [1, 2, 3, 4, 5] empty_array = [] def my_select(collection) i = 0 new_collection = [] while i < collection.length # do something if yield(collection[i]) new_collection << collection[i] end # add to i each time through the loop i = i + 1 end # return new array new_collection...
true
17f553bc68fb3ee766972e684541733733b5d102
Ruby
owlworks/solvers_solver
/building.rb
UTF-8
995
2.734375
3
[]
no_license
require 'yaml' class BuildingManager attr_reader :list_buildings def initialize @list_buildings = YAML.load(File.open("./building_data.yml")) end def enumerate_available(company) list_available = [] company_outlay = company.outlay company_research = company.research @list_buildings.each do ...
true
392ba071b5d98dca5f8fdbb542c77dcc4002e59e
Ruby
trivedib/ruby-modular-mono
/engines/core-dal/app/api/core/dal/address_repo.rb
UTF-8
2,202
2.671875
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Core module Dal # Repository object that provides CRUD and other DB operations on Address domain model. class AddressRepo class << self # method to create a new address instance into DB def create(entity) identity = Core::Dal::Address.creat...
true
99296b9a13f3a8bdef45c2175e5b270d6af1b6b2
Ruby
GijuAmbrose/ruby-programs
/Threesum.rb
UTF-8
463
3.609375
4
[]
no_license
class Threesum def initialize (input,n) c = [] s = 2**n i = 0 arr = [] c = input.combination(3).to_a c.each do |ele| 3.times do |j| s += ele[i][j] puts s if s == 0 arr[i] = ele[i][j] end end end puts arr end end puts "Enter the...
true
4c99b773a4d34ca12f33f8e2a004a70b04470dab
Ruby
dalyc/smith2
/lib/smith/commands/smithctl/rm.rb
UTF-8
1,158
2.65625
3
[]
no_license
# -*- encoding: utf-8 -*- module Smith module Commands class Rm < Command def execute case target.size when 0 responder.value("No queue specified. Please specify a queue.") else target.each do |queue_name| Smith.channel.queue("smith.#{queue_name}", :pa...
true
11d7a2b6dea69dc3592c64828d0aa75d33e2d597
Ruby
ikwzm/rbvhdl
/lib/rbvhdl/ast/expression/shift_expression.rb
UTF-8
872
2.5625
3
[ "BSD-2-Clause" ]
permissive
module RbVHDL::Ast # # shift_expression : simple_expression # | simple_expression "sll" simple_expression # | simple_expression "srl" simple_expression # | simple_expression "sla" simple_expression # | simple_expression "sr...
true
7ee3777690e0a92b7e3f25c412dbfdb952b99003
Ruby
ewelinaszoda/ruby-enumerables-hash-practice-nyc-pigeon-organizer-lab-lon01-seng-ft-042020
/nyc_pigeon_organizer.rb
UTF-8
1,467
3.703125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def nyc_pigeon_organizer(data) pigeon_list = {} data.each do |key, values| values.each do |value, names_array| names_array.each do |name| pigeon_list[name] ||= {} pigeon_list[name][key] ||= [] pigeon_list[name][key] << value.to_s end end end pigeon_list end =begin...
true
1a2a39d27d2558760caee8207dba41a9baf3e0a9
Ruby
resant18/AAClasswork
/W4D3/chess/pieces/king.rb
UTF-8
333
2.78125
3
[]
no_license
require_relative "module/stepable_module" require_relative "piece" class King < Piece include Stepable def symbol :K end def move_diffs [[1, 1], [1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1], [0, 1]] end end # board = Board.new # k = King.new(:W, board, [0, 3]) # p k.moves # p k.symbol # ...
true
1019cdebc2fd0a5182f442e35b85a58532e34ea2
Ruby
kurisu/abcrunch
/lib/abcrunch/tester.rb
UTF-8
2,191
2.546875
3
[ "MIT" ]
permissive
module AbCrunch module Tester def self.test(pages) results = [] pages.each do |page| passed, qps_result, errors = AbCrunch::PageTester.test(page) results << { :page => page, :passed => passed, :qps_result => qps_result, :errors => errors ...
true
13fb81bba8b43a4ac806215d3753d25d1f2b6ca4
Ruby
xively/xively-rb
/lib/xively-rb/resource.rb
UTF-8
1,078
2.53125
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
module Xively class Resource ALLOWED_KEYS = %w(feed_id datastream_id datastream_trigger_id) ALLOWED_KEYS.each { |key| attr_accessor(key.to_sym) } include Validations def valid? pass = true if feed_id.blank? && datastream_id.blank? && datastream_trigger_id.blank? errors[:feed_id] ...
true
20866d8c652587ecbd36cb8ae9b7a6fcdabe2e59
Ruby
mmrobins/cookingcompendium
/test/unit/ingredient_test.rb
UTF-8
1,900
2.671875
3
[]
no_license
require 'test_helper' class IngredientTest < ActiveSupport::TestCase @@ingredient_default_values = { :recipe_id => 1, :food_id => 1, :quantity => 2.5, :units => "lbs", :percent_yield => 100, :prep_instructions => "chop finely", :position => "1" } def test_creating_ingredient_should_...
true
667a6087aae832b9453d6379a80ee04777ce67fe
Ruby
jfinkhaeuser/unobtainium-cucumber
/features/step_definitions/action.rb
UTF-8
2,070
2.578125
3
[ "MITNFA" ]
permissive
# coding: utf-8 # # unobtainium-cucumber # https://github.com/jfinkhaeuser/unobtainium-cucumber # # Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium-cucumber # contributors. All rights reserved. # require 'unobtainium-cucumber/action/screenshot' require 'unobtainium-cucumber/action/content' require_relat...
true
e97038cdda551c1092ab8409662d42e87e6a3b7b
Ruby
Ami-tnk/rubybook
/chapter3/even_odd.rb
UTF-8
37
2.78125
3
[]
no_license
puts 2.even? puts 3.even? puts 3.odd?
true
c262b00c45c2ffc88aa347a1500054f1cb5d00fd
Ruby
dongho108/python-ruby
/Logical/1.rb
UTF-8
201
3.03125
3
[]
no_license
real_egoing = "egoing" real_k8805 = "k8805" puts("아이디를 입력해주세요") input = gets.chomp() if input == real_egoing or input == real_k8805 puts("Hello! ") else puts("who are you") end
true
65ef9f10b36cd6dbf0e857da6b518f5cc385903f
Ruby
Ksingh22/ruby_studio
/Game&Player/studio_game/lib/studio_game/player.rb
UTF-8
1,303
3.4375
3
[ "LicenseRef-scancode-other-permissive" ]
permissive
require_relative 'treasure_trove' require_relative 'playable' module StudioGame class Players include Playable attr_accessor :name, :health attr_reader :score def initialize(name, health = 80) @name = name.capitalize @health = health @found_treasure = Hash.new(0) end def to_s "I'm #{@na...
true
5b553d740b4dce0a84a9004efb11b6539381cdb2
Ruby
dkindler/Project-Euler-Solutions
/048.rb
UTF-8
283
3.390625
3
[]
no_license
# https://projecteuler.net/problem=48 def raise(a, b, m) if b == 1 a elsif b.even? c = raise(a, b/2, m) c*c % m else c = raise(a, b/2, m) c*c*a % m end end sum = 0 1.upto(20000) do |n| sum = (sum + raise(n, n, 10000000000)) % 10000000000 end puts sum
true
f24469d4e97755e3ca8646497b994a6150199cc6
Ruby
b-enji-cmd/flash_cards
/lib/round.rb
UTF-8
2,141
3.875
4
[]
no_license
class Round attr_reader :deck , :turns , :number_correct def initialize(deck, turns = []) @deck = deck @turns = turns @number_correct = 0 end def first_card deck.cards[0] end def take_turn(guess) turn_test = Turn.new(guess, current_card) ...
true
f56fc602c9544caa4afe85835ca21f9e86511fbf
Ruby
mmitchell/mmitchell.github.io
/code/merge_sort.rb
UTF-8
381
3.65625
4
[ "MIT" ]
permissive
def mergesort(arr) return arr if arr.length <= 1 mid = arr.length / 2 left = arr[0..mid-1] right = arr[mid..-1] merge(mergesort(left), mergesort(right)) end def merge(left, right) sorted = [] until left.empty? || right.empty? if left[0] <= right[0] sorted << left.shift else sort...
true
69d5897f6c396cd79f09ad78d355fcd39bbeb014
Ruby
mamantoha/uz-api
/lib/uz/api.rb
UTF-8
1,406
2.609375
3
[ "MIT" ]
permissive
require 'json' require 'mechanize' require 'jjdecoder' require 'byebug' require 'uz/api/version' require 'uz/api/methods' module UZ class APIError < ArgumentError; end class TokenError < ArgumentError; end class API attr_reader :token JJ_ENCODE_PATTERN = /0\);}\);(.+)<\/script>/i TOKEN_PATTERN = /l...
true
72a8e919dae46f3438c4062b0bbec1a9738c2bf5
Ruby
merrua/ruby
/ex5a.rb
UTF-8
506
4.09375
4
[]
no_license
even = 10 odd = 7 # %d Convert argument as a decimal number. # %u Identical to 'd' # %i same as d puts "Lets add a even number %d and an odd number %d." % [even, odd] # b Convert argument as a binary number. puts "Lets out the numbers in Binary" puts "A even number %b and an odd number %b." % [even, odd] inches ...
true
0ce8e71448abe99d036d3d461959901cdb8cf49e
Ruby
sakikazu/relatives-sns
/app/models/ranking.rb
UTF-8
2,373
2.609375
3
[]
no_license
# == Schema Information # # Table name: rankings # # id :integer not null, primary key # classification :integer # content_type :string(255) # nice_count :integer # created_at :datetime not null # updated_at :datetime not null # content_id :integer # class ...
true
8bf4f70f02bbeef1e8d58ed5f3c08f94de2bfb6f
Ruby
hectorhuertas/turing_machine
/lib/printer.rb
UTF-8
1,905
3.59375
4
[]
no_license
module Printer def self.print_machine(tape, state, position) puts [ build_positioned_head(state,position), print_tape(tape) ] end def self.print_tape(tape) # => tape is an array of numbers ascii_tape=["","",""] tape.each do |number| ascii_tape = add_split(ascii_tape) ascii...
true
786adac662c27102c1818e00fa34ffdbf194efb4
Ruby
citation-file-format/ruby-cff
/test/formatters/bibtex_test.rb
UTF-8
2,758
2.515625
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
# frozen_string_literal: true require_relative '../test_helper' require 'cff/formatters/bibtex' require 'cff/file' class CFFBibtexFormatterTest < Minitest::Test describe 'all bibtex fixtures' do Dir[::File.join(FORMATTER_DIR, '*.cff')].each do |input_file| define_method("test_converter_for_#{File.basenam...
true
2bb2e287b3650d7b10da60cb91e08dfbd929c499
Ruby
hmesander/battleshift
/spec/services/values/space_spec.rb
UTF-8
748
2.890625
3
[]
no_license
require 'rails_helper' describe Space do context 'initialize' do it 'has valid attributes' do space = Space.new(['A1', 'A2']) expect(space.coordinates).to eq(['A1', 'A2']) expect(space.contents).to eq(nil) expect(space.status).to eq('Not Attacked') end end context 'instance metho...
true
bdae3949fc4e3bf5a70893987101181843b42177
Ruby
raquelnishimoto/ruby_intro
/facets_of_ruby/OrageTree.rb
UTF-8
1,221
4.0625
4
[]
no_license
class OrangeTree def initialize @birth = 2019 @age = Time.now.year - @birth end def a_one_year_passes @age += 1 if @age > 99 puts "Your tree died" end end def height # height in meters @height = @age * 0.5 until @age < 100 end def count_the_oranges if @age > 35 &&...
true
2534ade02259290ab441e948c394045e581198cf
Ruby
angstr0m/ADPraktikum
/lib/MergeSort.rb
UTF-8
2,239
3.3125
3
[]
no_license
require './AbstractSorter' #test class MergeSort < AbstractSorter def performSort() sortBetween(0,@data.size) end def sortBetween(index1, index2) @data = split(@data.slice(index1, index2)) end def split(datalist) if (datalist.size <= 1) return datalist end index_half = (da...
true
cd29d1fec32dda3824b6d1e7704291d72444878f
Ruby
Karanveer-singh671/mathGame
/main.rb
UTF-8
978
3.84375
4
[]
no_license
require './question' require './player' puts "player 1's name will be? " player1_name = gets.chomp puts "player 2's name will be?" player2_name = gets.chomp player1 = Player.new(player1_name) player2 = Player.new(player2_name) current_player = 0 while(player1.alive? && player2.alive?) do player = (current_play...
true
cd611db909fc828086b54b6bf9bf40d14b31840f
Ruby
solmengs/seattle-web-102819
/11-retake-review/social_media.rb
UTF-8
208
2.765625
3
[]
no_license
class SocialMedia attr_reader :name, :website_url @@all = [] def initialize (name, website_url) @name = name @website_url = website_url @@all << self end def self.all @@all end end
true
676860262bf90eee2963aca13d4a98f303589b30
Ruby
spalak/tennis-kata
/test/models/tennis_game_test.rb
UTF-8
4,085
3.09375
3
[]
no_license
require 'test_helper' class TennisGameTest < ActiveSupport::TestCase # test "the truth" do # assert true # end test "score starts as love-love" do game = TennisGame.new("Mike", "Dave") assert_equal("love-love", game.score) end test "score goes to 15-love when a player scores" do game = Tenn...
true
2ec0a7e4e153404fec2c101a474dcca70eaa843a
Ruby
MarciaOrr/firehose_image-blur
/temp/image.rb
UTF-8
939
3.46875
3
[]
no_license
class Image attr_accessor :image def initialize(image) @image = image @rows = @image.size @cols = @image.first.size end def blur @image_copy = Array.new(@rows) {Array.new(@cols)} @image.each_with_index do |row, row_index| row.each_with_index do |cell, col_index| ...
true
b84861d51ad81a3f36c79c7a119711d600c96d2b
Ruby
ndonnellan/finance
/lib/person.rb
UTF-8
1,161
3.375
3
[]
no_license
COLUMNS = 15 class Person attr_reader :accounts, :tax_account def initialize(name) @name = name end def print_tax_rate total_income = @taxable_income.reduce(:+) total_tax = @taxes_paid.reduce(:+) + @tax_account.balance printf "eff tax|%#{spacing-1}.1f%%\n", (total_tax / total_income * 100.0) ...
true
c91086a5351a376bd9e22bf9a5667554be33f657
Ruby
Mardiniii/full-stack-bootcamp-ruby
/Ruby/OOP/oop.rb
UTF-8
711
3.46875
3
[]
no_license
class Transaction attr_accessor :user, :date, :concept, :amount end class Invoice < Transaction attr_accessor :number end class Income < Transaction end class Expense < Transaction end class Humano attr_accessor :name, :age, :genre def initialize(name, age, genre) @name = name @age = age @genre...
true
743b66d46ae35214a5a6e8d5c77b0e367b4263fd
Ruby
tiyd-rails-2015-01/battleship
/battleship_test.rb
UTF-8
16,610
3.359375
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './battleship' $mock_inputs = [] def get_user_input $mock_inputs.shift end class BattleshipTest < Minitest::Test #This is not good practice, AND it forces you to do dumb things like test_00_ # in the code. However, it's easier to follow as you're le...
true
6f3f6476ced67364f300cd68e1ba481716e8651e
Ruby
prathamesh1993/intro-to-tdd-rspec-and-learn-bootcamp-prep-000
/current_age_for_birth_year.rb
UTF-8
59
2.640625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def current_age_for_birth_year(number) 2003 - number end
true
28bdc7a5678f37880a2410e3f7e61b07eabd8dbb
Ruby
oddruud/Ruby-Hive
/lib/hive/common/move/move_exception.rb
UTF-8
330
2.5625
3
[]
no_license
class Hive::MoveException < RuntimeError attr :ok_to_retry attr :code attr :message def initialize(code, message, ok_to_retry) @ok_to_retry = ok_to_retry @code = code @message= message end def to_string() return "Move Exception #{@code}: #{@message}, retry: #{@ok_to_retry}" end ...
true
6968d328e5f1b945d9fe7aea69e404a2d312ea1c
Ruby
mayaugusto7/learn-ruby
/modulo20-classes-02/monkey_patching_part_03.rb
UTF-8
367
3.328125
3
[]
no_license
class Fixnum def seconds self end def minutes self * 60 end def hours self * 60 * 60 end def days self * 60 * 60 * 24 end def custom_times i = 0 while i < self yield(i + 1) i += 1 end end end 5.custom_times { |i| puts i} # puts Time.now + 45.minutes # pu...
true
25bdc3741b10d1d1b8a1dc2013894c6a8b7070a9
Ruby
pecuerre/travel_demo
/lib/travel_demo/flight.rb
UTF-8
4,345
2.625
3
[]
no_license
module Sample class Flight @flight_ways=['One way flight', 'Two way flight'] @stops=['1 stop', '2 stops', '3 stops', 'multistops'] @flight_types=['Business', 'First Class', 'Economy', 'Premium Economy'] @inflight_features=['Available', 'Not Available'] @airlines=['Major Airline', 'United Airline...
true
1973f9efac5fa29c6ae2151c3645a68d44d4e041
Ruby
WGretz/rpg_dice
/lib/lib/dice.rb
UTF-8
1,596
3.28125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
class Dice attr_accessor :num_of_dice, :sides @@max_dice = nil @@max_sides = nil def initialize(num_of_dice,sides, options={}) options = filter_options(options) raise ArgumentError, "Your sides exceeds the maximum number of sides allowed" if @@max_sides && sides > @@max_sides raise Argum...
true
19e1d703417a53b919f771b6ed826a48dbb04112
Ruby
Smesworld/jungle_app
/spec/models/user_spec.rb
UTF-8
3,143
2.5625
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do describe 'Validations' do subject { described_class.new( first_name: "First", last_name: "Last", email: "email@test.com", password: "test", password_confirmation: "test" )} it "is valid with valid...
true
924fb940efdca5e5cb474268ee4c1b7ca02b8300
Ruby
ICRAR/TSN_alpha
/app/helpers/profiles_helper.rb
UTF-8
2,911
2.5625
3
[]
no_license
module ProfilesHelper def credit_location(profile) gsi = profile.general_stats_item bonuses = gsi.bonus_credits pogs = gsi.boinc_stats_item nereus =gsi.nereus_stats_item out = [] first = "&nbsp;&nbsp;&nbsp;" bonuses.each do |b| reason = "<abbr title=\"#{b.reason}\">Bonus Credit</abb...
true
66faf6601955c19551d5d868dc9705d94ebd33a3
Ruby
yous/algospot
/problems/encrypt.rb
UTF-8
140
3.03125
3
[]
no_license
gets.to_i.times do chunks = ['', ''] gets.chop.each_char.with_index do |ch, idx| chunks[idx % 2] << ch end puts chunks.join end
true
28e36ff0ffbd0f17a9b0d6acfd377cda18307e1f
Ruby
MisterrW/codeclan-karaoke
/karaoke/specs/song_spec.rb
UTF-8
771
3.125
3
[]
no_license
require('minitest/autorun') require('minitest/rg') require_relative('../song.rb') class SongTest < MiniTest::Test def setup @song1 = Song.new({name: "Toxic", artist: "Britney Spears", lyrics: "...but you know that you're toxic", genre: "pop"}) @song2 = Song.new({name: "Marianne", artist: "Leonard Cohen", lyr...
true
0d78c7d2065a79341b197dbcb4a7bfc4d7383592
Ruby
Kira-kyuukyoku/OpenClassRooms
/mooc_start_ruby/bouclesIterator.rb
UTF-8
71
3.046875
3
[]
no_license
10.times do |i| puts "Hello #{i}" i.times do puts "World" end end
true
61d2aef12c4074008388117e9e2dd79409d516a5
Ruby
failure-driven/playing-with-tcr
/tcr-rspec-dojo/lib/tennis.rb
UTF-8
488
3.40625
3
[]
no_license
class Tennis SCORES = ["love", 15, 30] def initialize @points = { s: 0, r: 0 } end def score return "deuce" if deuce? score = @points.values.map { |point| SCORES[point] } score[1] = "all" if same_score? score.join(" ") end def point(*players) players.each do |player| @point...
true
8af29959858f97205c782bc85edb8e231b9bea4d
Ruby
s-espinosa/mastermind
/lib/play.rb
UTF-8
859
3.703125
4
[]
no_license
require_relative 'game' require_relative 'print_text' require_relative 'clean_text' module Play def self.start_game difficulty = ask_difficulty game = Game.new(difficulty) PrintText.short_instructions(difficulty) game.take_turn ask_play_again end def self.ask_difficulty puts "How diffic...
true
9f476d3ff2357a684e6c2faf74c7fac5cb28963b
Ruby
mikeboan/jumpstart-beginner-track
/problem_sets/problem_set_3_solution.rb
UTF-8
1,271
4.03125
4
[]
no_license
def third_greatest(array) array.sort[-3] end # ************************************ def count_vowels(string) count = 0 vowels = ["a", "e", "i", "o", "u"] string.chars.each do |character| if vowels.include?(character) count += 1 end end count end # ************************************ de...
true
e6be4fd2ad73b4732292fd0694c1f23c63e7b6fe
Ruby
kanwei/algorithms
/benchmarks/sorts.rb
UTF-8
918
2.734375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
$: << File.join(File.expand_path(File.dirname(__FILE__)), '../lib') require 'algorithms' include Algorithms require 'rubygems' require 'rbench' RBench.run(5) do sorts = %w(ruby comb_sort heapsort insertion_sort shell_sort quicksort mergesort) sorts.each { |sort| self.send(:column, sort.intern) } n = 1000 ...
true
42c7a57a6fd0fe430b6d1ff2a74a090b67320297
Ruby
Eden-Eltume/101
/101_Exercises/Small_Problems2/Easy6/ex6.rb
UTF-8
215
3.796875
4
[]
no_license
def merge(arr1, arr2) new_arr = [] until arr1.empty? new_arr << arr1.pop end until arr2.empty? new_arr << arr2.pop end new_arr.sort.uniq! end p merge([1, 3, 5], [3, 6, 9]) == [1, 3, 5, 6, 9]
true
5bfb08ab842c527f9f8f47bfee0800fcb480d562
Ruby
dpolivaev/runner
/test/server/stream_writer_test.rb
UTF-8
958
2.546875
3
[ "BSD-2-Clause" ]
permissive
require_relative 'test_base' require_source 'stream_writer' class StreamWriterTest < TestBase def self.id58_prefix '55t' end # - - - - - - - - - - - - - - - - - test 'dF7', %w( write(s) is a no-op when s is empty ) do assert_equal '', write('') end # - - - - - - - - - - - - - - - - - test 'd...
true
1500bbb797d2091b713084e496d7a54aa321dd14
Ruby
pliantmeerkat/Calculator
/lib/Calc.rb
UTF-8
660
3.671875
4
[]
no_license
# calculator class class Calc attr_reader :total attr_reader :operations def initialize @total = 0 @operations = [] # data struct for operations storage end def add(arr) @operations.push(arr.join(' + ')) @total = arr.inject(:+) end def subtract(arr) @operations.push(arr.join(' - ')) ...
true
9c1bc2ce275c64eacb072f7cf14276666824df2d
Ruby
michpara/file-io-and-serialization
/hangman.rb
UTF-8
5,422
3.546875
4
[]
no_license
require 'yaml' def word() flag = true while(flag) line = File.readlines('5desk.txt').sample if line.length >= 5 and line.length <= 12 flag = false break end end return line end def person() hangman = [""" ----- | | | | | | | | | -------- """, """ ----- | | | 0 |...
true
a8582663e4a6e6acfc78877fe0419bdaeb59d3f8
Ruby
bingxie/code-questions
/lib/leetcode/189_rotate-array.rb
UTF-8
765
3.78125
4
[ "MIT" ]
permissive
# @param {Integer[]} nums # @param {Integer} k # @return {Void} Do not return anything, modify nums in-place instead. def rotate(nums, k) array = Array.new(nums.size) 0.upto(nums.size - 1) do |i| array[(i + k) % nums.length] = nums[i] end nums.each_index do |i| nums[i] = array[i] end end nums = [1,...
true
1f2b7aafa2ccb1effec0b40d817cac448e015155
Ruby
gavinlaking/vedeu
/test/lib/vedeu/cells/support/html_test.rb
UTF-8
2,753
2.65625
3
[ "MIT" ]
permissive
require 'test_helper' module Vedeu module Cells describe HTML do let(:described) { Vedeu::Cells::HTML } let(:instance) { described.new(cell, options) } let(:cell) { Vedeu::Cells::Char.new(colour: { background: background, ...
true
03a2a31e39072054e2c03e966d6fb9a7f23f6c01
Ruby
reddavis/panda-mysql-and-activerecord
/lib/mysql_modules/mysql_user.rb
UTF-8
740
2.71875
3
[]
no_license
module MySqlUser module ClassMethods def authenticate(login, password) unless u = self.find_by_login(login) return nil else puts "#{u.crypted_password} | #{encrypt(password, u.salt)}" u && (u.crypted_password == encrypt(password, u.salt)) ? u : nil end end ...
true
916f1fb0d78d693076bed45d6b1e3c04d3c682f3
Ruby
gregorymostizky/katas
/kata02/chop.rb
UTF-8
990
3.796875
4
[]
no_license
module Chop # iterative chop def chop_iterative(number, array) return -1 if array.empty? left = 0 right = array.size - 1 begin pointer = left + ((right-left) / 2) if array[pointer]==number return pointer elsif number > array[pointer] left = left == pointer ? lef...
true
f0bc3bec006741ad861f3fdef844af2a1de31c5d
Ruby
bcarrol2/oo-uber
/driver.rb
UTF-8
425
3.375
3
[]
no_license
class Driver attr_reader :name @@all = [] def initialize(name) @name = name @@all << self end def self.all @@all end #Gets all the rides associated with a driver def allrides Ride.all.select do |ride| ride.driver == self end end #Get all the passsengers associated with thi...
true
4894455bb6d798b07681d49c2c4dd41ffb9959a2
Ruby
gypsydave5/boris-bikes
/lib/person.rb
UTF-8
547
2.9375
3
[]
no_license
class Person attr_reader :total_time_bike_hired def initialize(bike=nil) @bike = bike end def has_bike? not @bike.nil? end def has_accident! @bike.break! self end def rent_bike_from docking_station @bike = docking_station.release_bike @bike.set_time_bike_was_hired self end def retu...
true
4bcc7090d5fa4561e9c9ab9a66a8fe94e9cfa92c
Ruby
wildfauve/foucault_http
/lib/foucault_http/logger.rb
UTF-8
595
2.609375
3
[ "MIT" ]
permissive
module FoucaultHttp class Logger FILTERS = ["password"] def call(level, message) logger.send(level, filtered(message)) if ( logger && logger.respond_to?(level) ) end def configured_logger logger end private def logger @logger ||= configuration.config.logger end ...
true
961fcda95a368bd1727c075d37651e8e22145647
Ruby
kgilla/building-blocks
/lib/bubble_sort_by.rb
UTF-8
494
3.6875
4
[]
no_license
def bubble_sort_by (arr) unsorted = true while unsorted == true unsorted = false for a in 0...arr.length - 1 result = yield(arr[a], arr[a + 1]) if result > 0 arr[a], arr[a+1] = arr[a+1], arr[a] unsorted = true end end ...
true
f1a24afa3a881ae641daabbfb7be41b8ba47baf6
Ruby
TheGrayWolf/Ruby_Exercises_and_Programs
/Operators.rb
UTF-8
449
4.125
4
[]
no_license
# == equal operator p 10 == 10; a = 10; b = 5; c = 10; p a == c; p a == b; p c == a; p 5 == 5.0; # != inequality operator p "hello" != "hello"; p "hello" != "Hello"; p "hello".downcase != "HeLlo".downcase p "123" != 123; # < and > do the same thing as in pute mathematics # <= less or equal ---> greater or e...
true
7c5a20e8726fd3df4aadcfa04c5e57766108c369
Ruby
emre-basala/dxf-reader
/lib/dxf/dimension.rb
UTF-8
1,653
2.875
3
[]
no_license
module DXF class Dimension < Entity # 5 hanlde attr_reader :pairs attr_accessor :x1, :y1, :z1 attr_accessor :x2, :y2, :z2 attr_accessor :x3, :y3, :z3 attr_accessor :x4, :y4, :z4 attr_accessor :handle attr_accessor :layer_name attr_accessor :block_name attr_accessor :drawn_as...
true
48f88829fc44703f51e0affdbe098171d92054fc
Ruby
emadb/kata_and_quiz
/tennis_game/lib/game.rb
UTF-8
614
3.4375
3
[]
no_license
class ZeroZero end class Game def initialize @players = [0,0] @score_map = { '1-0' => 'fifteen-love', '1-1' => 'fifteen-all', '2-3' => 'thirty-forty', '0-3' => 'love-forty', '3-3' => 'deuce', '4-3' => 'advantage player one', '4-5' => 'advantage player two', ...
true
5a4f7ef5a926550f45dbf9065741a7ba84ce0e01
Ruby
cklim83/launch_school
/04_rb130_more_topics/03_exercises/04_medium_1/06_method_to_proc.rb
UTF-8
10,541
4.3125
4
[]
no_license
=begin Method to Proc In our Ruby course content on blocks, we learn about "symbol to proc" and how it works. To review briefly, consider this code: comparator = proc { |a, b| b <=> a } and the Array#sort method, which expects a block argument to express how the Array will be sorted. If we want to use comparator to...
true
164d3713643fea15d9e6c7c333915f5bada1b08e
Ruby
theodi/csv-profiler
/tests/tc_csvProfiler.rb
UTF-8
1,174
2.78125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'test/unit' require 'csv_profiler' class TestCsvProfiler < Test::Unit::TestCase def setup @cp = CsvProfiler.new("tests/fixtures/ppms-november-with-columns-10000.csv") @profile = @cp.get_stats end def test_output_cleanup_cell dirty = '" foo bar "' clean = 'foo bar' assert_blo...
true
dcc5b10d1ba56ba5e34a338cf1a631f358bd953f
Ruby
cairesr/hackerrank
/ruby/warmpup/diagonal_difference.rb
UTF-8
359
3.4375
3
[]
no_license
args = STDIN.read.split array_size = args[0].to_i array_values = args.slice(1, args.size) first_diagonal_sum = 0 second_diagonal_sum = 0 0..(array_size - 1) do |iterator| first_diagonal_sum += (array_size * iterator) + iterator second_diagonal_sum += (array_size * (iterator + 1)) - (iterator + 1) end puts (first_...
true
bbe1e5fb475c1d697f07828cfa5150d10481619e
Ruby
loadcode229/top_breweries
/lib/scraper.rb
UTF-8
1,317
3.015625
3
[ "MIT" ]
permissive
class TopBreweries::Scraper def self.get_brewery_info html = Nokogiri::HTML(open("https://www.thrillist.com/drink/nation/the-best-craft-brewery-in-every-state-in-america/")) #opens url and reads all HTML states = html.css('h2').map(&:text) #variable states gets all 'h2' selectors in 'html' and gets...
true
b90bccac66675460a9e50981d427a1c064e784a8
Ruby
bonzouti/RUBY-MVC
/lib/view.rb
UTF-8
376
2.703125
3
[]
no_license
class View def initialize end def create_gossip params = {} puts "ton histoire marante" print ">" params[:content]= gets.chomp puts "c'est l'histoire de qui ?" print ">" params[:author]= gets.chomp return params end def index_gossips(gossips) gossips.each {|goss| put...
true
a8399e2f119bef2d56ff7e03680567892978ea20
Ruby
Solveug/Tutorial-Simdyanov
/chapter10/task3.rb
UTF-8
72
2.75
3
[]
no_license
surnames = %w[Иванов Петров Сидоров Алексеева Казанцев Антропов Анисимов Кузнецов Соловьев Кошкина] puts surnames.sort
true
a5c452a4fd9cc05b5e84b429f3b00b89536b958a
Ruby
AlisherZakir/cartoon-collections-london-web-051319
/cartoon_collections.rb
UTF-8
589
3.46875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(dwarves)# code an argument here # Your code here dwarves.each_with_index {|dwarf, i| puts "#{i + 1}. #{dwarf}"} end def summon_captain_planet(array)# code an argument here # Your code here array.each do |x| x[0] = x[0].upcase x << "!" end end def long_planeteer_calls(calls)# co...
true
aa63071f333433e2222fe6eda4ea1b12991fabe4
Ruby
ciousiaocing/leetcode-ruby
/algorithms/maximum_subarray.rb
UTF-8
266
3.53125
4
[]
no_license
def max_sub_array(nums) sum, subsum = nums[0], nums[0] 1.upto(nums.size - 1) do |idx| subsum = 0 if subsum < 0 subsum += nums[idx] # 取最大值 sum = subsum if sum < subsum p sum end sum end p max_sub_array([-2,1,-3,4,-1,2,1,-5,4])
true
147e0f4f5398f64f31e8db6a8e9f005b06faf79c
Ruby
Codilot/blogger
/app/models/article.rb
UTF-8
777
2.59375
3
[]
no_license
class Article < ApplicationRecord has_many :comments, dependent: :destroy # ensures that all articles have a title of min 2, max 62 characters long validates :title, presence: true, length: { in: 2..70, message: "Title must have minimum 2, maximum 62 characters." } # ensures that all article...
true
62561528b2c7d9744d7ac6acf341ca3b912d7c6d
Ruby
richrace/Mars-Rover-First-Attempt
/spec/util_spec.rb
UTF-8
1,947
3.40625
3
[]
no_license
require './util' # Tests to ensure the common methods are correct describe Util do before(:all) do class TempObj include Util end end describe "#split_line" do it "should return array of 2 elements" do util = TempObj.new util.split_line("AB").length.should == 2 util.split_line("A B").length.shoul...
true
e068d9783e9e01f2be4c4952ac7e3349beb67fab
Ruby
NoDanCoder/holberton-system_engineering-devops
/0x06-regular_expressions/5-beginning_and_end.rb
UTF-8
187
2.984375
3
[]
no_license
#!/usr/bin/env ruby # The regular expression must be exactly matching a string that starts # with h ends with n and can have any single character in between puts ARGV[0].scan(/h.n/).join
true
7adc87c9d878593303f9a6e812970883a8e579c3
Ruby
snly2386/StyleMe
/spec/integration/gameplay_spec.rb
UTF-8
4,382
2.890625
3
[]
no_license
# require 'spec_helper' # describe 'Gameplay' do # let(:game) { RabbitDice.db.create_game :players => ['Alice', 'Bob', 'Carl'] } # def rig_dice(*dice_results) # RabbitDice::Roll.any_instance.stub(:roll_die).and_return(*dice_results) # end # def play_move(move) # result = RabbitDice::PlayMove.run(:gam...
true
7de2ca78911cf1e74db2997c5be8356cdabe6019
Ruby
stager94/poker-holdem
/spec/poker_spec.rb
UTF-8
1,194
2.65625
3
[]
no_license
require 'spec_helper' require './poker' describe Poker do before do @poker = Poker.new end it do expect(@poker.deck).to be_kind_of Deck expect(@poker.table).to be_kind_of Table expect(@poker.players.length).to eq 3 end context '#distribution_cards_to_players' do it do expect { @poker.send :distrib...
true
0e655123b40d7fd263d0fb75bc61f49a7b7057f6
Ruby
iref/housekeeper-archived
/test/circle_test.rb
UTF-8
6,223
2.515625
3
[ "MIT" ]
permissive
require "test_helper" describe Housekeeper::Circle do before do @circles = Housekeeper::mongo["circles"] @users = Housekeeper::mongo["users"] token = Housekeeper::GoogleToken.new "abcsd", "accessthis", 1234, Time.at(765432109) @userB = Housekeeper::User.new "octomama@github.com", token @userB...
true
d78e75d47ec84f551b3127f6a3493e88cf75cefc
Ruby
davidmjiang/tag_crawler
/spec/web_scraper_spec.rb
UTF-8
1,511
2.75
3
[ "MIT" ]
permissive
require 'spec_helper' describe TagCrawler do let(:scraper){TagCrawler::WebScraper.new("test")} let(:html_doc){Nokogiri::HTML('<html><head><link rel="stylesheet" href="styles.css"/></head><body><a href="link">Link</a><a href="link2">Here\'s another link</a></body>')} let(:html_string){'<html><head><link rel="stylesh...
true
35c408ff4f70dc66e0dcc7839d5886404da0210a
Ruby
Touklakos/Hashi
/Sauvegarde/Grille.rb
UTF-8
3,705
3.515625
4
[]
no_license
require "matrix" # Cette classe represente une grille. class Grille #@longueur -> Sa longueur. #@largeur -> La largeur. #@table -> la matrice. #@sommets -> Sa liste de sommets. # Creer une grille. # === Parametre # * +longueur+ : Longueur de la grille (nombre de case). # * +largeur+ : Largeur de la gr...
true
aa7b999547403449313498aaaecc5d009bfd517c
Ruby
karanvalecha/twitter_clone
/test/models/user_test.rb
UTF-8
2,602
2.625
3
[]
no_license
require 'test_helper' class UserTest < ActiveSupport::TestCase def setup @user = User.new(name: "example", email: "example@example.com", password: "password", password_confirmation: "password" ) end test "Error for nil digest" do assert_not @user.authenticated?(:remember, '') end test "User must ...
true
8108c1947f6b13ccb09e88e762935144fca5bbfe
Ruby
kellypowers/ruby-objects-has-many-through-lab-onl01-seng-ft-012120
/lib/doctor.rb
UTF-8
561
3.21875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Doctor attr_accessor :name @@all = [] def initialize(name) @name = name @@all << self end def self.all @@all end def appointments Appointment.all.select{|i| i.doctor == self} end def new_appointment(patient, date) new_appointment...
true
0cbe7e469ecc45ceb35c2f738a9b7fa9d0ececab
Ruby
bhuelbue/yamanalysis
/yam_thread_img.rb
UTF-8
9,777
2.6875
3
[]
no_license
require 'date' require 'optparse' require './yam_config.rb' require './lib/yam_database.rb' require './lib/yam_getUserPhoto.rb' def shortName(name) nname = name nname = nname[0, 8] if name.length > 8 nname = nname.gsub("-", '') return nname end def writeGraphvizLabelByName(f, name) gvlabel = "label=\"\"...
true
6f823cb93427938c7c82ec1f0081f692aef278bd
Ruby
tltaylor22/tic_tac_toe
/random_ai.rb
UTF-8
422
3.203125
3
[]
no_license
class Random_AI attr_reader :marker # a reader attribute to read marker def initialize(marker) @marker = marker # the @ symbol is an instance variable that can be used anywhere within the instance of the class end def get_move(board) # passing the index of each element in the array and then selecting e...
true
4a94d2a335571a31f2b2611001fc7afa43e7c579
Ruby
zzeni/academy-app
/lib/error/not_eligible_for_course_error.rb
UTF-8
222
2.515625
3
[ "MIT" ]
permissive
require_relative './application_error.rb' module Error class NotEligibleForCourseError < ApplicationError def initialize(message = "The chosen course is too difficult for the student") super end end end
true
f6a3a315e5195584b9805ee695b10ac4ca8aa48d
Ruby
postmodern/deployml
/lib/deployml/remote_shell.rb
UTF-8
3,525
3.109375
3
[ "MIT" ]
permissive
require 'deployml/exceptions/invalid_config' require 'deployml/shell' require 'addressable/uri' module DeploYML # # Represents a shell running on a remote server. # class RemoteShell < Shell # The history of the Remote Shell attr_reader :history # # Initializes a remote shell session. # ...
true
f7e5ba79a1dbe49b470ba5ef54f16fc2173a3e7f
Ruby
readyready15728/advent-of-code-2020
/07a.rb
UTF-8
1,552
3.3125
3
[]
no_license
require 'set' bag_descriptions = [] File.readlines('07.txt').each do |line| bag_type = line.match('\A(.*?) bags')[1] contents = [] unless line.match('contain no other bags') line.scan(/(\d+) (.*?) bags?/).each do |count, color| contents.push [color, count] end end bag_descriptions.push({"bag...
true
a6f485a794fd166f4f1b1e015d08a7e5a3ddb1e5
Ruby
shvets/misc-ruby
/check_gem_deps2.rb
UTF-8
447
2.609375
3
[]
no_license
require 'rubygems' require 'httparty' class RubyGemsApi include HTTParty base_uri 'rubygems.org' def self.info_for(gems) res = get('/api/v1/dependencies', :query => { :gems => gems }) Marshal.load(res) end def self.display_info_for(gems) info_for(gems).each do |info| puts "#{info[:name]} ...
true
cfa58550326353fcd65dbe5eae0c6c101930c92b
Ruby
svetlik/Core-Ruby-1
/week2/1-vectors/vector_solution_test.rb
UTF-8
1,807
3.140625
3
[ "MIT" ]
permissive
require 'minitest/autorun' require_relative 'vector_solution' class SolutionTest < Minitest::Test def test_length vector = Vector.new(3, 4, 5, 6) assert_equal 86**0.5, vector.length end def test_magnitude vector = Vector.new(3, 4, 5, 6) assert_equal 86**0.5, vector.magnitude end def test...
true
fcbaaf9f33601d4472f93a1487f48fd705dceb42
Ruby
Dorish/DataDriven
/Tools/IE/del_cache.rb
UTF-8
4,395
2.578125
3
[]
no_license
#!/bin/ruby # # # # # # set TEMPIF=%USERPROFILE%\Local Settings\Temporary Internet Files # %TEMPIF%\Content.IE5\Index.DAT #TODO This file needs to be cleaned up require 'Win32API' # # # HashMethods = a Hash that can be accessed with methods # e.g. h = MethodHash.new # h['street'] = 'Broadway' # ...
true
1d6383b8a1e6cb701506dd22a049eafe2b982a50
Ruby
Koyirox/s3_desafio_2arrays
/2.rb
UTF-8
1,114
3.796875
4
[]
no_license
a = [1,2,3,9,1,4,5,2,3,6,6] # Eliminar el último elemento puts 'arreglo original' p a a.delete_at(-1) puts 'elimina ultimo elemento del arreglo' p a #Eliminar el primer elemento. a.delete_at(0) puts 'elimina el primer elemento' p a #Eliminar el elemento que se encuentra en la posición media, si el arreglo tiene...
true
275a91d11efc73fb767530ead55dfe7b9d7540b7
Ruby
u2313nori/learning-Ruby
/Book01/Chapter02/2.8.3_ruby-sample.rb
UTF-8
234
2.625
3
[]
no_license
# encoding: utf-8 a = <<TEXT テストテストテストテストテスト テストテストテストテスト テストテストテスト テストテスト テスト TEXT puts a puts a.class def test a puts a end test "bbb"
true
a580bf987d8eb7f0d2b5ac349a2a1296569fcda9
Ruby
robbiejaeger/black_thursday
/lib/sales_analyst.rb
UTF-8
6,603
3.015625
3
[]
no_license
require 'time' require 'bigdecimal' require 'bigdecimal/util' class SalesAnalyst attr_reader :sales_engine def initialize(sales_engine) @se = sales_engine end def average_items_per_merchant (@se.items.all.count.to_f/@se.merchants.all.count.to_f).round(2) end def standard_deviation(set, avg) ...
true
2beefc3a57c8800f6cf2fc4d0be7c0a796862079
Ruby
mattkiernan/ruby
/leap.rb
UTF-8
259
3.484375
3
[]
no_license
puts 'provide a start year >>' start = gets.chomp puts 'provide an end year >>' finish = gets.chomp while start.to_i <= finish.to_i if start.to_f % 4 == 0 and (start.to_f % 100 != 0 or start.to_f % 400 != 0) puts start.to_i end start = start.to_i + 1 end
true
93b3750472554424642b9efe58b009c1c950ed3a
Ruby
violaleeblue/tealeaf-intro-to-programming-ruby
/methods.rb
UTF-8
603
4.5
4
[]
no_license
puts "exercise 1" def greet(name) puts "Hello " + name + "!" end puts greet('Mary') puts "exercise 2" puts "the integer 2" puts "nil" puts "Joe" puts "the string four" puts "nil" puts "exercise 3" def multiply(num1, num2) return num1 * num2 end puts "multiplying 4 times 5 is " + multiply(4,5).to_s puts "exercise...
true
8a2de710aaafe73c13fd2d4ae12899e92840a5ac
Ruby
RaymondMcT/quandl_operation
/lib/quandl/operation/collapse.rb
UTF-8
8,583
2.75
3
[ "MIT" ]
permissive
# subclasses require 'quandl/operation/collapse/guess' # collapse module Quandl module Operation class Collapse class << self def perform(data, type) type = {:freq => type} if type.class != Hash assert_valid_arguments!(data, type) # nothing to do with an empty array return data unless...
true
e41c8d3106d75d097776d7b38e6bf0f8ac6630a2
Ruby
maciek-rr/misc
/reqlog.rb
UTF-8
1,331
2.671875
3
[]
no_license
require 'net/http' module ReqLog def self.hack_net_http_request!(opts={}) dest_dir = opts[:dest_dir] || "/tmp" klass = Net::HTTP unless klass.method_defined?(:request_without_logging) klass.send(:alias_method, :request_without_logging, :request) end klass.send(:define_method, :request) do ...
true
970d8a1576158bf83b90739855c54a8a66f5b798
Ruby
StinaD/project_budget_tracker
/models/tag.rb
UTF-8
940
3.140625
3
[]
no_license
require( 'pry-byebug' ) require_relative('../db/sql_runner') class Tag attr_reader :id, :tag_name def initialize( options ) @id = options['id'].to_i if options['id'] @tag_name = options['tag_name'] end # class functions --------- def self.delete_all sql = "DELETE FROM tags;" SqlRunner.run( s...
true