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
11f4e2835f0a36cc2952d18a6b0f35d64c44877a
Ruby
mauricioszabo/random_stuff
/hex_input/spec/hexagono_spec.rb
UTF-8
1,524
2.796875
3
[]
no_license
require 'hexagono' describe Hexagono do before do Hexagono.send :class_variable_set, :@@fonte, @fonte = mock('Font') end context 'na criação' do it 'deve criar um hexágono completo' do SDL::Surface.should_receive(:load).with('imagens/cima.png') SDL::Surface.should_receive(:load).with('imagen...
true
381264999f568d3b21cc041a055255cb4235c684
Ruby
phallguy/scorpion
/lib/scorpion/hunter.rb
UTF-8
2,356
2.796875
3
[ "MIT", "Vim" ]
permissive
module Scorpion # A concrete implementation of a Scorpion used to hunt down food for a {Scorpion::Object}. # @see Scorpion class Hunter include Scorpion # ============================================================================ # @!group Attributes # # @return [Scorpion::DependencyMap] m...
true
1ca5e5aff162a484fd30004dad8b56c8d0d604a2
Ruby
nimbu/nimbu-api
/lib/nimbu-api/builder.rb
UTF-8
763
2.59375
3
[ "MIT" ]
permissive
# encoding: utf-8 require 'nimbu-api/utils/all' module Nimbu class Builder # Instantiates a new Nimbu api object # def self.new(klass, options={}, &block) return create_instance(klass, options, &block) if klass raise ArgumentError, 'must provide Endpoint class to be instantiated' end ...
true
db55c4f6e2cf5825d5d1276300cdf8786984bce3
Ruby
mzw86020424/practice
/20210210_amldt.rb
UTF-8
910
3.453125
3
[]
no_license
array = gets.split(' ') n = array[0].to_i #ダイエットの日数 s = array[1].to_i #ダイエット開始前の動物の体重 t = array[2].to_i #動物が超えてはいけない体重 alts = [] #n日分の各日の選択肢(配列in配列) i = 0 arr = [] n.times do arr = gets.split(' ') alts << arr end i = 0 n.times do alts[i][0] = -1 * alts[i][0].to_i alts[i][1] = alts[i][1].to_i i += 1 end # a...
true
b821e4ba50b24855de7ec60d2d6d36f76ce1020b
Ruby
zunda/http-refusing-server
/web.rb
UTF-8
923
2.734375
3
[ "MIT" ]
permissive
#!/usr/bin/ruby require 'socket' port = ENV.fetch('PORT'){3000}.to_i wait = ENV.fetch('WAIT'){20}.to_i host = ENV.fetch('DYNO'){Socket.gethostname} res_body = "Hello from #{host}!\r\n" res_body_len = res_body.bytesize res_header = <<_END.gsub("\n", "\r\n") HTTP/1.1 200 OK Content-Length: #{res_body_len} Content-Type:...
true
bfb4f4318dce6d1171507aa17e7a2fb37dd491d4
Ruby
CodeCoreYVR/awesome_answers_nov_2020
/app/controllers/sessions_controller.rb
UTF-8
1,097
2.65625
3
[]
no_license
#rails g controller sessions class SessionsController < ApplicationController def new end def create @user = User.find_by_email params[:email] if @user && @user.authenticate(params[:password]) # authenticate is a method created by has_secure_password in a User model behind the s...
true
79ca2f4b85e086419e190e3a259c21f4fdf28b55
Ruby
stijnster/acts_as_translated
/lib/acts_as_translated.rb
UTF-8
1,467
2.640625
3
[ "MIT" ]
permissive
require 'acts_as_translated/version' module ActsAsTranslated require 'acts_as_translated/railtie' if defined? Rails::Railtie def self.included(base) class << base attr_reader :cached_translated_attributes end base.extend(ClassMethods) end module ClassMethods def acts_as_translated(*...
true
123caedd8df3835512ff6b1f40945313417b3e81
Ruby
bluurn/rekord
/lib/rekord/repo.rb
UTF-8
2,321
2.6875
3
[ "MIT" ]
permissive
require 'active_support/inflector' module Rekord class Repo attr_reader :storage def initialize(storage) @storage = storage end def find(model, key_val) data = storage.get_by_key(model.table_name, model.key, key_val) if data.nil? raise NotFound else model.new...
true
70ba3122e94f64a2e6bac8eda770285ad8063643
Ruby
nathansobo/arel
/lib/arel/relations/operations/where.rb
UTF-8
555
2.609375
3
[]
no_license
module Arel class Where < Compound attributes :relation, :predicate deriving :== def initialize(relation, *predicates, &block) predicate = block_given?? yield(relation) : predicates.shift @relation = predicates.empty?? relation : Where.new(relation, *predicates) @predicate = predicate.b...
true
2be6157be430333cfc49879d700ac3503e733d29
Ruby
Malachirwin/card_game_war
/lib/player.rb
UTF-8
293
3.546875
4
[]
no_license
class Player def initialize(name, cards=[]) @cards = cards @name = name end def name @name end def cards_left @cards.count end def play @cards.shift end def set_hand(cards) @cards = cards end def take(cards) @cards.push(*cards) end end
true
4e4de42d12492d7048877b884942a994aea9f551
Ruby
mrflip/worblehat
/lib/archive/repository.rb
UTF-8
4,764
2.609375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'archive/repository/user' require 'archive/repository/exceptions' require 'archive/repository/ftp_session' require 'net/http' module Archive class Repository # # Checks if the payload exists # # Note that this does *not* reserve the identifier, # so race conditions may exist. # ...
true
cfbd55e01fb761074a4e9edafa29a580058b05d7
Ruby
Seraff/blasto
/bin/scripts/gff_to_blast.rb
UTF-8
1,675
2.65625
3
[]
no_license
#!/usr/bin/env ruby require_relative 'lib.rb' params = Slop.parse do |o| o.banner = "Convert blast hits file with amino acid coordinates to gff annotation with nucleotide indicies\n" o.string '-in', '(required) Input file.' o.string '-out', 'Output GFF file.' o.string '-t', '--target', '(required) Source for g...
true
39029fa9a68dca0ca05bf5a4c9fb008b9a39152d
Ruby
AlexRevin/drivy
/backend/app/util/loader.rb
UTF-8
546
2.8125
3
[]
no_license
require "json" module Util class Loader attr_accessor :cars, :rentals, :rental_modifications def initialize file_name @raw_data = JSON.parse IO.read(file_name) end def cars @cars ||= @raw_data["cars"].map{|item| Models::Car.new(item)} end def rentals @rentals ||= @ra...
true
cfc6263d0a091877832e89c09c3e4ed0fac2942c
Ruby
dankleiman/daily_programmer
/blackjack.rb
UTF-8
1,363
4.09375
4
[]
no_license
# From r/dailyprogrammer: http://www.reddit.com/r/dailyprogrammer/comments/24r50l/552014_161_easy_blackjack/ # So went to a Casino recently. I noticed at the Blackjack tables the house tends to use several decks and not 1. My mind began to wonder about how likely natural blackjacks (getting an ace and a card worth 10 ...
true
b7c604107122b36e05107bc324fab6ec6788527d
Ruby
rochefort/code_eval
/moderate/06_lowest_common_ancestor/lowest.rb
UTF-8
1,429
3.71875
4
[]
no_license
#!/usr/bin/env ruby class Node attr_accessor :value, :left, :right def initialize(value) @value = value @left, @right = nil, nil end def ancestor(n) return value if (left and n == left.value) or (right and n == right.value) left.ancestor(n).instance_eval{ |v| return v if v } if left rig...
true
9401744d11e3cc39285ee846a340e538802e0bac
Ruby
tobyond/stairwell
/test/stairwell/types/boolean_type_test.rb
UTF-8
784
2.53125
3
[ "MIT" ]
permissive
require "test_helper" class Stairwell::Types::BooleanTypeTest < Minitest::Test def test_valid_when_valid_with_true string_type = Stairwell::Types::BooleanType.new(true) assert_equal true, string_type.valid? end def test_valid_when_valid_with_false string_type = Stairwell::Types::BooleanType.new(fa...
true
8c30267ffdc4805d4e9766ea6cc35d93922541a9
Ruby
ski-climb/sorting_suite
/practice/merge_sort_practice.rb
UTF-8
1,655
4.0625
4
[]
no_license
require 'pry' class MergeSort attr_accessor :completely_split_up, :sorted_array def initialize @completely_split_up = [] @sorted_array = [] end def sort(scrambled_letters) cut_in_half(scrambled_letters) puts "scrambled array: #{scrambled_letters}" merge_together(completely_split_up) ...
true
d09e19ea111bea7ad417ca5a346fbaac190af5c9
Ruby
NavyBye/ft_transcendence
/pong/app/models/tournament_participant.rb
UTF-8
2,178
2.71875
3
[]
no_license
class ParticipantsCountValidator < ActiveModel::Validator def validate(record) tournament = record.tournament return unless !tournament.nil? && tournament.max_participants <= tournament.participants.count record.errors.add :base, "Too many participants" end end class TournamentParticipant < Applicatio...
true
c0864b8f251886a3cf9b2490fd9296b19154275f
Ruby
blulight/Episode7
/spec/sales_person_spec.rb
UTF-8
803
2.8125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require_relative "../lib/sales_person" require_relative "../lib/calculates_route" describe SalesPerson do it "should have many cities" do city = stub subject.schedule_city(city) subject.cities.should include(city) end it "should keep the cities only scheduled once" do city = stub expect{ subject.sche...
true
df5d2e7713b4cd9818bf68697803a905ddcc9228
Ruby
emmaladouceur/final_project
/textingme.rb
UTF-8
505
2.84375
3
[]
no_license
require 'twilio-ruby' class Text def texting(recipient) account_sid = 'ACe330ba04d082392df4cb3511dcb72cec' auth_token = '2008ea097713e401a16c54029058da82' @client = Twilio::REST::Client.new(account_sid, auth_token) @recipient = recipient @client.account.messages.create( :from =...
true
f966c073a669e450a052f041ee8e735e8ef8714b
Ruby
marshall159/anagram_mystery
/spec/features/word_is_anagram_spec.rb
UTF-8
671
3.6875
4
[]
no_license
# As an investigator, # I would like to check whether a word is an anagram of any of the words in a given list, # so that I can solve the mystery of the crime, given the clues left behind describe 'Anagram' do it 'checks if a word is an anagram from a list' do given_there_is_a_file_of_anagrams when_the_user_...
true
697a15b9342698310722dd6c185154f4ae9c3b45
Ruby
josediaz16/quiz_api
/app/services/quizzes/graded_quiz_builder.rb
UTF-8
647
2.84375
3
[]
no_license
class Quizzes::GradedQuizBuilder def initialize(quiz_id) @quiz_id = quiz_id @correct_answers = 0 end def new_graded_quiz @graded_quiz = GradedQuiz.new(quiz_id: @quiz_id) end def add_answer(answer) @correct_answers += 1 if answer.correct? @graded_quiz.answers.build(question_id: answer.qu...
true
e96c39f1775dfc8965d225669d66e71e618cbfbe
Ruby
ver2point0/ruby-way
/2-working-with-strings/represent-string-alternate-notations.rb
UTF-8
347
2.640625
3
[]
no_license
s1 = %q[As Magritte said, "Ceci n'est pas une pipe."] s2 = %q[This is not a tab: (\t)] s3 = %Q[This IS a tab: (\t)] s4 = %q(Bill said, "Bob said, 'This is a string.'") s5 = %q{Another string.} s6 = %q<Special characters ''[](){} in this string.> s7 = %q:"I think Mrs. O'Leary's cow did it,", he said.: s8 = %q*\r is a ...
true
b178d5e42c976c4970736fa6d0fde9480ab6d14c
Ruby
atauf/learn_ruby
/03_simon_says/simon_says.rb
UTF-8
572
4.0625
4
[]
no_license
def echo(string) return string end def shout(string) return string.upcase end def repeat(string, num = 2) return string + (" " + string)*(num-1) end def start_of_word(string, num = 1) return string[0..(num-1)] end def first_word(string) end_of_word = string.index(" ") return string[0..(end_of_word-1)] end de...
true
bcb1e7a73a54457a55759f94c8d912fb75c6f43a
Ruby
sgwdev/codility-ruby-solutions
/L4-Counting-elements/FrogRiverOne.rb
UTF-8
461
3.15625
3
[]
no_license
# https://app.codility.com/programmers/lessons/4-counting_elements/frog_river_one/ def solution(x, a) # write your code in Ruby 2.2 leaf_number = Array.new(x+1,0) leaf_position_sum = (1..x).reduce(:+) a.each_with_index do |leaf_position, time| if leaf_number[leaf_position] == 0 leaf_number[leaf_posit...
true
6ab663eb5a44bdc18162344eb0a43bb2bc8664c7
Ruby
lecharles/cartage
/lib/cartage/config.rb
UTF-8
5,332
2.78125
3
[ "MIT", "LicenseRef-scancode-other-permissive" ]
permissive
require 'ostruct' require 'pathname' class Cartage # The Cartage configuration structure. The supported Cartage-wide # configuration fields are: # # +target+:: The target where the final Cartage package will be created. Sets # Cartage#target. Equivalent to <tt>--target</tt>. # +name+:: The name ...
true
0234278ee0973974d9dbfb7c507f2f6bf7f21c06
Ruby
Aerotune/Mini-Puzzler
/system/gosu_interface/Sprite.rb
UTF-8
2,385
3.015625
3
[]
no_license
class Sprite DefaultMode = :loop DefaultFPS = 0 attr_accessor :dt_frame, :frame attr_reader :image, :images, :last_frame def initialize options={} @images = options[:images] || raise( ArgumentError, "AnimatedSprite, didn't find :images in options" ) @last_frame = @images.length - 1 @frame = 0...
true
3b320fc7203b2afe25989ef85542f5dc96ad4160
Ruby
davidsanchezr81/homework_week02
/bar.rb
UTF-8
341
2.71875
3
[]
no_license
class Bar attr_reader(:till) def initialize(till) @till = till end def check_till return @till end def add_money_to_till() return @till += rooms.roomprice() end def pay_room() @till.add_money_to_till(rooms.roomprice()) guests.remove_money_from_wallet(rooms.roomprice()) end ...
true
184f4d7844d5e9a13bdb4eb4b295878fa17ec96d
Ruby
alverion/Final-Project
/app/models/member.rb
UTF-8
1,079
2.671875
3
[]
no_license
require 'digest/sha2' class Member < ActiveRecord::Base has_many :cliq_members has_many :cliq_invitations validates :first_name, :presence => true validates :last_name, :presence => true validates :email, :uniqueness => true validates :password, :confirmation => true attr_accessor :password_confirmatin attr...
true
2b0cc052d311a96ddd9f4b8fc8d1985c422cf04d
Ruby
itggot-adam-rohdell/dungeon-crawler
/lib/collision_manager.rb
UTF-8
2,167
3.3125
3
[]
no_license
require 'byebug' class Collision_manager def initialize(player,tiles,enemies,items) @player = player @items = items @tiles = tiles @enemies = enemies end def button_down(id) if id == Gosu::KbLeft if if_walkable_move(@player, @tiles, :l) if_walkable_move(@enemies[0], @tile...
true
9a5c6f5061ae5f57c6460d4abce9daae0a0bf8bb
Ruby
rmascarenhas/snp
/lib/snp/template.rb
UTF-8
1,797
2.96875
3
[ "MIT" ]
permissive
require 'erb' module Snp # Snp::TemplateNotFound # # This exception is raised in case the template file passed is not found in any # directory in snp path. class TemplateNotFound < StandardError def initialize(template_name, path) super("Template #{template_name} was not found in #{path.inspect}") ...
true
e94cf2b40d1f641395877acd542604dbf40badc2
Ruby
kmurph73/google_sheets
/lib/google_sheets/session.rb
UTF-8
2,984
2.640625
3
[]
no_license
# frozen_string_literal require 'google/apis/sheets_v4' require 'googleauth' require 'googleauth/stores/file_token_store' require 'fileutils' require 'google_sheets/sheet' require 'google_sheets/spreadsheet' module GoogleSheets class Session OOB_URI = 'urn:ietf:wg:oauth:2.0:oob' CREDENTIALS_FILENAME = 'tok...
true
03b05f0aa120cf036ec63f1aecaa9d77f43e9348
Ruby
peteburch223/checkout
/lib/basket.rb
UTF-8
268
3.34375
3
[]
no_license
class Basket include Enumerable def initialize @all =[] end def each(&block) all.each(&block) end def add(item) all << item end def total all.reduce(0) { |total, item| total += item.price } end private attr_reader :all end
true
539b1ce517726daf6bae62522faf3f4682554425
Ruby
geeksam/hangman
/hangman.rb
UTF-8
2,852
3.75
4
[]
no_license
require_relative 'hangman_parser.rb' class Hangman # Sam: These classes don't make sense outside this namespace, so I moved them. class InvalidGuessError < StandardError; end class BadInputDataError < StandardError; end attr_accessor :puzzle, :solution, :solution_diff, :puzzle_with_guesses, :...
true
cb2c02eb18b3b889c88e7a19a130e6292e9a2ae2
Ruby
justinetroyke/night_writer
/lib/translator.rb
UTF-8
2,293
3.265625
3
[]
no_license
class Translator attr_reader :input, :braille_alphabet def initialize(input) @input = input @braille_alphabet = { "a"=>['0.','..','..'], "b"=>['0.','0.','..'], "c"=>['00','..','..'], "d"=>['00','.0','..'], "e"=>['0.','.0','..'], "f"=>['00','0.','..'], ...
true
e9dc2d7fa8af766b073f2b371265ab42bdb46f66
Ruby
Pistos/Reby
/kicker.rb
UTF-8
3,447
2.78125
3
[]
no_license
# kicker.rb # Kicks people based on public PRIVMSG regexps. # By Pistos - irc.freenode.net#mathetes # This is not a standalone Ruby script; it is meant to be run from Reby # (http://purepistos.net/eggdrop/reby). class Kicker CHANNELS = [ "#mathetes", '#christian', ] WATCHLIST = { 'scry' => [ ...
true
1d7cebac9491f7e4875f05ed67083710d7ec1e93
Ruby
GandT/learning
/Ruby/season2/p027-032/p027.rb
UTF-8
132
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- =begin  2017.5.2  timesメソッド =end 10.times{ print "隣接訪問者果実過食傾向問題" }
true
21d194200d2613c19cf20b8277debb072907cd85
Ruby
Marcus893/W2D4
/time_exercises/time.rb
UTF-8
737
3.515625
4
[]
no_license
def my_min1(list) list.each_with_index do |el1,idx| exclude_el1 = list[0...idx] + list[idx+1..-1] return el1 if exclude_el1.all? do |el2| el1 < el2 end end end def my_min2(list) smallest = list.shift list.each do |el| smallest = el if smallest > el end smallest end def contig_sub_s...
true
17bf60bbec24b3cc189b8a4599367087f3623acd
Ruby
mdub/lazily
/spec/lazily/threading_spec.rb
UTF-8
1,628
2.75
3
[ "MIT" ]
permissive
require "spec_helper" describe Lazily, "threading" do describe "#in_threads" do it "acts like #collect" do expect([1,2,3].lazily.in_threads(5) { |x| x * 2 }.to_a).to eq([2,4,6]) end it "runs things in separate threads" do expect([1,2,3].lazily.in_threads(5) { Thread.current.object_id }.to_...
true
e6c1e98f297dd7a93b223aa4bd5b898d0596674e
Ruby
tobold/learn-to-program
/chap07/ch7ex5.rb
UTF-8
929
4.21875
4
[]
no_license
#Chapter 7 #7.5 bottles = 99 while true puts bottles.to_s + ' bottles of beer on the wall, ' + bottles.to_s + ' bottles of beer.' puts 'you take one down and pass it around...' bottles = bottles - 1 puts bottles.to_s + ' bottles of beer on the wall.' puts if bottles == 1 puts '1 bottle of beer on the wall' b...
true
266563382616b4bbe99fce66da998f5bece7938a
Ruby
jaclync/github-csv-changelog
/lib/github-csv-changelog.rb
UTF-8
10,312
2.796875
3
[ "MIT" ]
permissive
require 'net/http' require 'net/https' require 'uri' require 'json' require 'csv' require 'io/console' require 'optparse' # /// Constants. /// GITHUB_API_NOTE = "Github commit parser." COMMIT_PARSER_API_TOKEN_ENV_KEY = "COMMIT_PARSER_API_TOKEN" # /// Helper functions for network requests. /// # Makes POST request w...
true
2a25c7d1a059497b878c7776deae2d64335ecded
Ruby
danslimmon/servertag
/lib/view.rb
UTF-8
1,337
3.078125
3
[]
no_license
module ServerTag class View # Initializes given the base name of the template and the type of data to return. # # 'accept' may be an array like Sinatra's 'request.accept' or a single symbol such # as :json or :html. def initialize(base_name, accept) @base_name = b...
true
0e5d2afe85ce8e69373a017895a757863f52b0cb
Ruby
stellashen/aA-PairProgramming
/W1D5/KnightPathFinder.rb
UTF-8
1,288
3.34375
3
[]
no_license
require './skeleton/lib/00_tree_node' require 'byebug' class KnightPathFinder def initialize(start_pos) @start_pos = start_pos @board = Array.new(8) { Array.new(8) } @visited_positions = [start_pos] end def self.valid_moves(pos) valid_pos = [] r, c = pos possible_pos = [[r-2,c-1],[r-2,c+...
true
31cf8f33687695e90491ebac7ca3de01464df3a5
Ruby
alexch/deep-test
/sample_rails_project/vendor/rails/activesupport/lib/active_support/core_ext/logger.rb
UTF-8
445
2.890625
3
[ "Ruby", "MIT" ]
permissive
# Adds the 'around_level' method to Logger. class Logger def self.define_around_helper(level) module_eval <<-end_eval def around_#{level}(before_message, after_message, &block) self.#{level}(before_message) return_value = block.call(self) self.#{level}(after_message) return ...
true
8d0173e5a2cd52a4d3697fe91711e253da238a29
Ruby
sh6khan/ruby-algo
/graphs/topological_sort/topological_sort.rb
UTF-8
2,232
3.34375
3
[]
no_license
require 'minitest/autorun' require_relative 'graph' require_relative 'node' class TopologicalSort def initialize() @sorted_order = [] @visited = {} end def sort(graph) graph.nodes.each do |node| depth_first_search(node) unless @visited[node] end return @sorted_order.reverse end p...
true
26e68dc06b4f8ffed2e2f7d5033f937cec7b442d
Ruby
bdetwiller/reviews
/tenure.rb
UTF-8
590
2.703125
3
[]
no_license
class Tenure attr_accessor :restaurant_id, :start_date, :end_date, :head_chef, :chef_id attr_reader :id def initialize(attributes) @id = attributes['id'] || nil @restaurant_id = attributes['restaurant_id'] @start_date = attributes['start_date'] @end_date = attributes['end_date'] @head_chef = a...
true
5105a58ecba12e02d60d2457a37177de31519d39
Ruby
RYOUENDOU/sixth-work
/db/fixtures/development/001_product.rb
UTF-8
414
2.515625
3
[]
no_license
100.times do |i| # 100回繰り返す Product.seed_once(:id) do |product| product.id = i + 1 # idがずれていくように指定する product.title = "#{i + 1}番目の野菜" product.price = (i + 1) * 100 product.description = "#{i + 1}は、おすすめです。" product.image = Rails.root.join("app/assets/images/tomato.jpg").open product.is_available...
true
d91f82d6f0d2054d1f52ad9f840b3282003287b0
Ruby
samjones1001/oystercard
/lib/journey.rb
UTF-8
247
2.90625
3
[]
no_license
class Journey attr_reader :new_journey def start_journey(entry_station) @new_journey = {:start => entry_station, :end => nil} @new_journey end def finish_journey(exit_station) @new_journey[:end] = exit_station @new_journey end end
true
65768db66e7c0409817aea32fe2239a00926b6e8
Ruby
aws/aws-app-mesh-examples
/blogs/ecs-service-connectivity/yelb/yelb-appserver/modules/getrecipe.rb
UTF-8
575
2.703125
3
[ "MIT", "Apache-2.0", "MIT-0" ]
permissive
require 'rubygems' require 'httparty' def getrecipe() recipeurl = '{"recipelink_pancakes": "'+ getrecipeurl('pancake') + '", ' + '"recipelink_burritos": "' + getrecipeurl('burritos') + '", ' + '"recipelink_steak": "' + getrecipeurl('steak') + '", ' + '"recipelink_lasagne": "' + getrecipeurl(...
true
7332391bc73cb5234986b0c1e338a44bab9e0e4e
Ruby
MarcinBalejko/Ruby
/orangetree.rb
UTF-8
1,502
4.21875
4
[]
no_license
class OrangeTree def initialize @tall = 0 @age = 0 @fruit = 0 puts "A new orange tree is planted" end def height puts "The tree is currently " + @tall.to_s + "meters tall." end def count_the_oranges puts "There are currently " + @fruit.to_s + " oranges on the tree" end d...
true
9844307c4b3f045904fabe179223bb4ebd412511
Ruby
sesvxace/lexicon
/lib/lexicon.rb
UTF-8
16,205
3.21875
3
[ "MIT" ]
permissive
#-- # Lexicon v1.3 by Solistra and Enelvon # ============================================================================= # # Summary # ----------------------------------------------------------------------------- # This script provides information and browsing capabilities for all of the # RGSS3 scripts that are p...
true
1529445eb0ea2594f2125c033e7daaddb4d755f6
Ruby
gretchenista/skillcrush-ruby-challenge
/my_animals.rb
UTF-8
2,238
3.9375
4
[]
no_license
class Animal def set_name=(name) @name = name end def get_name return @name end def set_adjective=(adjective) @adjective = adjective end def get_adjective return @adjective end def set_breed=(breed) @breed = breed end def get_breed ...
true
e61afdd48af469dcc54f70fb70bf3a72f1fd456f
Ruby
christophe48/lundi_21-10_Sinatra
/the_gossip_project_sinatra/lib/gossip.rb
UTF-8
1,560
3.0625
3
[]
no_license
require 'bundler' Bundler.require class Gossip attr_accessor :content, :author def initialize(author, content) @content = content @author = author end def save CSV.open("./db/gossip.csv", "ab") do |csv| csv << [@author, @content] end end def self.all all_gossips = [] #on initialise...
true
2fa885f5561741409ee4f4d9375cd0b6ed1600fc
Ruby
montabano1/montechess
/queen.rb
UTF-8
252
2.96875
3
[]
no_license
require_relative 'sliding_piece.rb' require_relative 'piece.rb' class Queen < Piece attr_reader :type include SlidingPiece def initialize(color, board, pos) super(color, board, pos) @value = :Q @type = [:straight, :diag] end end
true
51597ac2e4d9a7614cd79b1077ed63d41428ad58
Ruby
conkdekriz/calendar-app
/app/models/valid_response.rb
UTF-8
710
2.703125
3
[]
no_license
# frozen_string_literal: true class ValidResponse < Response def initialize(hash, model_name: nil) super() @hash = hash @model_name = model_name @body = nil end # Returns an Object or an Array of Objects resulting from a correct request to the API def body data = @hash[:body] return @b...
true
767acf726acb93a3ec56e169aff9493d23bf9228
Ruby
enoc3994/CLASE_RUBY
/cuadrado.rb
UTF-8
328
3.734375
4
[]
no_license
class Cuadrado def initialize(*args) if arg.size < 2 || args.size > 3 puts 'Error: Este metodo toma dos o tres argumentos' else if args.size == 2 puts 'Dos Argumentos' else puts 'Tres Argumentos' end end end end Cuadrado.new([10,23],4,10) #Tres Argumentos Cuadrado.new([10,23],[14,16]) #Dos Ar...
true
880d08246e80c2de3ab5ae33cdd5f631c9523034
Ruby
totallyNotAdrien/mastermind
/codemaker.rb
UTF-8
1,938
3.796875
4
[]
no_license
require_relative "utils.rb" class Codemaker include Utils attr_reader :human def initialize(human = false) @human = human end def create_code if human human_code else computer_code end end def self.feedback(guess, code) if guess == code CORRECT * 4 else ...
true
42873a8349e92dbca3eba51a1381077181f2599e
Ruby
omajul85/well-grounded-rubyist
/enumerable/sorting_enumerables.rb
UTF-8
977
4.1875
4
[]
no_license
class Painting attr_reader :price, :year def initialize(price = 0, year = 2018) @price = price @year = year end def <=>(other_painting) @price <=> other_painting.price end def to_s @price end end # Remark that we do not need to include the Comparable module...
true
47c6376b2f61e1fe87fcd10a0480ca6315f07725
Ruby
stephaniemai/drivy
/backend/level5/repositories/option_repository.rb
UTF-8
1,012
3
3
[]
no_license
require_relative '../models/option' OPTIONS = { gps: 500, baby_seat: 200, additional_insurance: 1000 }.freeze # Repository of rental options class OptionRepository def initialize(json, rental_repository) @input = json @rental_repository = rental_repository @options = [] load_options end pri...
true
4d7b9e9bb3bce0930d713923ac7f33ff44037e9f
Ruby
jules2689/courses
/test/unit/models/course_category_test.rb
UTF-8
563
2.53125
3
[]
no_license
require 'test_helper' require 'models/course_category' class CourseCategoryTest < MiniTest::Test def setup @category = fake_course.categories.first end def test_handle assert_equal 'category_title_with_spaces', @category.handle end def test_link url = '/categories/category_title_with_spaces.htm...
true
d3416d6429381e9db39af490fc102cf7b7c7d180
Ruby
dgrzesiak/ruby
/Zadanie1-2/Zadanie2a/lib/babelkowe.rb
UTF-8
243
2.765625
3
[]
no_license
def babelkowe(tab) k = tab.length while k > 1 j = 0 while j < k - 1 do if tab[j] > tab[j+1] pom = tab[j] tab[j] = tab[j+1] tab[j+1] = pom end j = j + 1 end k-=1 end return tab end
true
22d1eed45d1823809300fe1679fa90cbac1a07ac
Ruby
NUBIC/ncs_mdes_warehouse
/lib/ncs_navigator/warehouse/transformers/mdes_csv/table_reader.rb
UTF-8
1,859
2.8125
3
[]
no_license
require 'ncs_navigator/warehouse' require 'csv' module NcsNavigator::Warehouse::Transformers::MdesCsv ## # A streaming reader for a CSV containing one table's-worth of MDES data. # # The CSV is converted into warehouse model instances, one record per row. The # CSV MUST have a header row whose cells indicat...
true
e5c237b9d0bb5c1e98106ba79e63d104a8a21b99
Ruby
tnordloh/adventofcode_2016
/d24_ducts/runme
UTF-8
1,836
3.046875
3
[]
no_license
#!/usr/bin/env ruby require_relative 'cubicle' layout = ARGF.readlines.map {|line| line.chomp.scan(/./) } waypoints = layout.each_with_index.map { |line,y| matcher = line.join.scan(/\d/) matcher.map do |number| puts "hi" x = line.index(number) puts "y:#{y} x:#{x},#{number}" [number.to_i,y.to_i,x...
true
4f5e710db033ed9143d6df72782de15407a259a3
Ruby
sumitsethtest/ruby-string-showdown
/tests/fizzbuzz.rb
UTF-8
597
2.6875
3
[]
no_license
require_relative "../test_helper" test = Test.new("Single vs Double Quoted Strings (FizzBuzz)", runs: 100) test.add_variant "Single Quoted" do 100000.times do |n| string = '' string << 'Fizz' if n % 3 == 0 string << 'Buzz' if n % 5 == 0 puts string.empty? ? n : string end end test.add_variant "Do...
true
51868d7080a9ecae5d8e73a0520a56efe910dbfe
Ruby
philiprlarie/project_euler
/problems_20-29/problem21.rb
UTF-8
441
3.640625
4
[]
no_license
# require_relative "sieve_of_eratosthenes.rb" # primes_under_100 = sieve_of_eratosthenes(100) # p primes_under_100 # # prime_factorization = {} nums = (2..10000) factor_sums = nums.map do |num| factors = [] (1..(num/2)).each do |factor| factors << factor if num % factor == 0 end factors.inject(:+) end h ...
true
878c8525081462194b0e73eddaaab39a8db482b6
Ruby
monicandreoli/le_wagon
/parsing-demo/csv_demo.rb
UTF-8
989
3.6875
4
[]
no_license
require 'csv' # TODO - let's read/write data from beers.csv # PARSING CSV : foreach. going from data format/text to ruby object filepath = 'data/beers.csv' # csv_options = { col_sep: ',', quote_char: '"', headers: :first_row } # # beers_array = [] # CSV.foreach(filepath, csv_options) do |row| # # Here, row is an...
true
ed6696621bacbf570dfff46ad4ad2763280e6959
Ruby
steverandy/mongoid_text_search
/lib/mongoid_text_search.rb
UTF-8
1,628
2.578125
3
[]
no_license
require "mongoid_text_search/keyword_generator" module Mongoid module TextSearch extend ActiveSupport::Concern included do before_save :set_keywords end module ClassMethods def search_fields @search_fields ||= [] end def text_search_for_fields(*fields)...
true
134fbbfde74dda85fcd6e7df13b34210c8a2dc3f
Ruby
arv25/advent_of_code
/2020/day8.rb
UTF-8
2,719
3.71875
4
[]
no_license
# Day8 #input = File.open('day8_input_eg.txt').readlines.map(&:chomp) input = File.open('day8_input.txt').readlines.map(&:chomp) require 'ostruct' def parse_instructions(input) input.map do |line| if line=~ /^(\w{3}) (.*)/ instruction($1.strip, $2.chomp.strip) end end end def instruction(cmd, value...
true
21d1f97c731783277e0f666528500c887b9bdb09
Ruby
ChristianCarey/project_tdd_minesweeper
/lib/board.rb
UTF-8
536
3.390625
3
[]
no_license
class Board attr_reader :size, :mines, :grid def initialize(size=10, mines=9) @size = size @mines = mines @grid = Array.new(10) { Array.new(10) { Cell.new }} end def setup place_mines end def place_mines @mines.times do set_random_mine end end def set_random_mine x...
true
fe54db5da3a7af0f907adaef70fbde04f69ea832
Ruby
AAMani5/learn-to-program
/chap10/ex4.rb
UTF-8
1,827
3.9375
4
[]
no_license
#!/usr/bin/env ruby #this method translates numbers to english characters def wedNum num #no negative numbers allowed if num < 0 return "Please enter a number greater than zero" end #if num > 100 # return "Please enter a number less than or equal to 100." #end numstring = '' #this is returned left = num one...
true
b4c78299e7db7f85743b3450295cc68b8b218e7f
Ruby
pandalowry/bashim
/lib/bash_parser.rb
UTF-8
1,305
3.109375
3
[]
no_license
require 'nokogiri' require 'open-uri' class BashParser attr_reader :posts #класс должен возвращать только посты в виде массива объектов def initialize @doc = Nokogiri::HTML open('http://bash.im/').read @doc.encoding = 'UTF-8' @posts = [] fill_posts end Post = Struct.new(:number, :ratio, :dat...
true
1dbe3df69d7105c5ec058129e0ece9da8f60e06f
Ruby
aarongough/flea
/spec/flea/standard_library/cons_spec.rb
UTF-8
705
2.734375
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'spec_helper' describe 'Standard Library' do describe 'cons' do before :each do @interpreter = Flea::Interpreter.new end it 'should create a list from an atom and an empty list' do result = @interpreter.run("(cons (quote a) (quote ()))") expect(re...
true
5307eb285c549a4a8cc6d6003864a56c278081d4
Ruby
Andyreyesgo/Gen45
/Pactice/lego.rb
UTF-8
208
3.34375
3
[]
no_license
class Lego @@count =0 def initialize(size) @size = 1 @@count += 1 end def total_pieces @@count end end piece1= Lego.new(1) piece2=Lego.new(2) piece2.total_pieces
true
029002e92ba001a088470a361319e909b9af0136
Ruby
SofiaSousa/ss_generator
/lib/ss_generator/helpers.rb
UTF-8
926
2.859375
3
[]
no_license
require 'fileutils' module SSGenerator module Helpers # take keys of hash and transform those to a symbols def transform_keys_to_symbols(value) if value.is_a?(Array) return value.map {|memo| transform_keys_to_symbols(memo) } elsif value.is_a?(Hash) return value.inject({}){|memo,(k,v)| memo...
true
5833477504207fd3b5224fedcf316c7a8657a0b1
Ruby
Anw0514/beta_fish_backend
/app/models/fish.rb
UTF-8
472
2.65625
3
[]
no_license
class Fish < ApplicationRecord has_many :fights, dependent: :destroy has_many :opponents, through: :fights def getStats hp = rand(600..1400) case true when hp >=1200 self.power = rand(600..800) when hp > 1000 self.power = rand(800..1000) when...
true
15c2a690e5f83945269b266d61dbd982718e21a5
Ruby
k49977/factory_bot
/spec/models/user_spec.rb
UTF-8
2,710
2.765625
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do # it "姓、名、メール、パスワードがある場合、有効である" do # # userのそれぞれのカラムに対して値を入れてオブジェクト化する # user = User.new( # first_name: "tarou", # family_name: "testman", # email: "testman@example.com", # password: "password", # ) # # オブジェクトをexpec...
true
3ebaee1916180a45059d782336e2e0ebe6b33e1f
Ruby
sadah/AtCoder
/AtCoderProblems/Medium/abc131/c/Main.rb
UTF-8
299
3.4375
3
[]
no_license
require 'pp' # 空白区切の入力値を数値の配列で返却する def gets_i_list() gets.chomp.split(" ").map(&:to_i) end A, B, C, D = gets_i_list E = C.lcm(D) total = 0 total += (B / C) - ((A-1) / C) total += (B / D) - ((A-1) / D) total -= (B / E) - ((A-1) / E) puts B - A + 1 - total
true
8af11f1ec1d2d2997e59f6ce9d31687b26a3a676
Ruby
TheBigLou/Learn-Ruby
/ex16.rb
UTF-8
1,228
4.0625
4
[]
no_license
# Making a simple text editor. filename = ARGV.first puts "We're going to erase #{filename}" puts "If you don't want that, hit CTRL-C (^C)." puts "If you do want that, hit RETURN." $stdin.gets puts "Opening the file..." target = open(filename, 'w') # 'w' tells system to open in write mode puts "Truncating the file...
true
5b9d9a2b71be049fce43d4abd35d44c3950bad4c
Ruby
ooyala/immunity
/lib/sinatra_api_helpers.rb
UTF-8
1,903
3
3
[]
no_license
# Convenience methods which assist in building JSON-based APIs. Mix these into any instance of Sinatra::Base. module SinatraApiHelpers MAX_JSON_REQUEST_BODY_SIZE = 1024 * 100 # 100K attr_accessor :json_body # Renders a 400 if any of the specified parameters are missing from the request's body. def enforce_re...
true
a811637ea1a67b53a23fa61d3a52ad6ab883a448
Ruby
firefaded/intro_to_programming
/exercises/exercise_10.rb
UTF-8
315
4.4375
4
[]
no_license
# Exercise 10 # Can hash values be arrays? Can you have an array of hashes? (give examples) # Yes, hash values can be arrays and yes, you can have an array of hashes # hash values as arrays people = {names: ["jane", "john", "ashley"]} # array of hashes names = [{name: "jane"}, {name: "john"}, {name: "ashley"}]
true
6c4a17ba8a31f66a605574eaf7a0cd5b5252e2a2
Ruby
ddd1600/twitter_research
/app/models/tweet.rb
UTF-8
1,636
3.015625
3
[]
no_license
class Tweet < ActiveRecord::Base # attr_accessible :title, :body attr_accessible :img_url, :screen_name, :real_name, :status, :tweeted_at, :user_id validates :screen_name, presence: true validates :status, presence: true validates :tweeted_at, presence: true validates :user_id, presence: true belongs_to :user...
true
4b5fa407544fa64c6c7fbf00cfc6a41d68ba0a3a
Ruby
jessenovotny/hella-pizza
/app/models/pizza.rb
UTF-8
1,105
2.734375
3
[]
no_license
class Pizza < ApplicationRecord has_many :pizza_toppings has_many :toppings, through: :pizza_toppings accepts_nested_attributes_for :toppings def toppings_attributes=(topping_hash) topping_hash.values.each do |attribute| unless attribute.values.first.empty? topping = Topping.find_or_create_by(at...
true
da9a8953532efd60968470f3c4cc2d837afe3d2f
Ruby
gnilrets/regex_sieve
/lib/regex_sieve.rb
UTF-8
1,888
3.71875
4
[ "MIT" ]
permissive
# Public: RegexSieve class. The RegexSieve functions in a manner similar # a hash. The regex sieve is initialized with a hash where the keys are # regular expressions and the values can be any valid Ruby object. The order # of the keys matters. When the regex sieve is accessed using the array # accessor [], it retu...
true
ebac715546973dc53d1536251d89fae5fb51db47
Ruby
whatcodehaveyougit/ruby_project_codeclan
/models/customer.rb
UTF-8
2,333
3.34375
3
[]
no_license
require_relative("../db/sql_runner") class Customer attr_reader :id attr_accessor :name, :address, :phone def initialize (options) @id = options['id'].to_i if options['id'] @name = options['name'].to_s @address = options['address'].to_s @phone = options['phone'].to_i end # ============== CREATE ======...
true
aa800f825ffda284bbbdfba71908f5a3ceb14b01
Ruby
ode-to-the-code/short-story
/test-inheritance.rb
UTF-8
334
3.5
4
[]
no_license
class Performer def add_tips swag = tips end def complain_about_rent puts "For fuck's sake, the rent is too damn high!" end def into_the_zone puts "It's all worth it" end end class Juggler < Performer def juggle puts "Let's do this!" end end x = Juggler.new puts x...
true
8b158c46138c3723418b9bf34c96405531a8e7b5
Ruby
npolar/api.npolar.no
/external/followit.se/bin/followit-download
UTF-8
1,183
2.578125
3
[]
no_license
#!/usr/bin/env ruby # Ruby-based command to download Followit tracking data # export FOLLOWIT_CREDENTIALS='username:password' && ./bin/followit-tracker /path/to/followit/archive 2014-05-01 # For more information: # https://github.com/npolar/api.npolar.no/tree/master/external/followit.se/README.md require "bundler/se...
true
73c27d9b4d706c3ea134eaf1ae51b022d80721ef
Ruby
bopopescu/churchbook
/app/models/student.rb
UTF-8
1,396
2.734375
3
[]
no_license
class Student < ActiveRecord::Base has_attached_file :image, styles: {large: "1920x1080#", medium: "800x500#", thumb: "100x100"}, :default_url => "/images/:style/missing.png" validates_attachment_content_type :image, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"] def current_age() now...
true
ced03a558a6b05468f420a2064e4e6eaeca2f08a
Ruby
coingecko/cryptoexchange
/lib/cryptoexchange/exchanges/lbank/services/pairs.rb
UTF-8
766
2.546875
3
[ "MIT" ]
permissive
module Cryptoexchange::Exchanges module Lbank module Services class Pairs < Cryptoexchange::Services::Pairs PAIRS_URL = "http://api.lbank.info/v1/currencyPairs.do" def fetch output = super adapt(output) end def adapt(output) market_pairs = [] ...
true
ecc86fd8c1a864f3ccc5cba75c6d0b656d8b9323
Ruby
castwide/solargraph
/lib/solargraph/range.rb
UTF-8
2,844
3.359375
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Solargraph # A pair of positions that compose a section of text. # class Range # @return [Position] attr_reader :start # @return [Position] attr_reader :ending # @param start [Position] # @param ending [Position] def initialize start, ending ...
true
b296abf40c601a4535f0c1a8e8545952e8f46f56
Ruby
ghaxhaj/ruby-oo-practice-flatiron-zoo-exercise-nyc-clarke-web-010620
/run.rb
UTF-8
374
2.875
3
[]
no_license
require_relative "lib/Animal.rb" require_relative "lib/Zoo.rb" require_relative "lib/Exhibit.rb" require 'pry' z1 = Zoo.new("Bronx Zoo","Bronx") z2 = Zoo.new("Cincinatti Zoo", "Ohio") a1 = Animal.new("Lion",450,"Simba") a3 = Animal.new("Lion",450,"Jimbo") a2 = Animal.new("Seal",90,"Cup") Exhibit.new(a1,z1) Exhibit.new...
true
9c98296a03fc518d03a2990f00ca5756068da882
Ruby
SyntheticAutomation/LaughTracks
/spec/features/user_sees_comedians_spec.rb
UTF-8
2,796
2.5625
3
[]
no_license
RSpec.describe 'A visitor to our app' do it 'should display a list of comedians and their info' do comedian = Comedian.create(name: "Adam Sandler", age: 52, city: "Brooklyn" ) special = comedian.specials.create(title: "Adam Sandler: Take Me Away From Here", runtime: 120, image: "https://static.independent.co....
true
de9b5d596c6ddde91819fcf797e0703d86b90cb0
Ruby
pumpedup/rez
/extensions/api.rb
UTF-8
2,678
2.671875
3
[]
no_license
require 'sinatra/base' require 'sinatra/json' # generate an absolute url including host def api_url(request, resource_name) if request.port == 80 port = "" else port = ":#{request.port}" end "#{request.scheme}://#{request.host}#{port}#{resource_name}" end module Sam module API # saves some info...
true
fc16a41a0939be8a06aee043837714ee7fa20afc
Ruby
commuterjoy/betfair
/examples/log_prices.rb
UTF-8
2,106
2.515625
3
[ "MIT" ]
permissive
require 'rubygems' require 'betfair' require 'etc' require 'ostruct' auth = IO.read(Etc.getpwuid.dir + '/.betfair/auth') mid = ARGV[0] interval = 10 bf = Betfair::API.new({ :credentials => auth }) helpers = Betfair::Helpers.new market = bf.get_market(1, mid) market_info = helpers.market_info(market) puts "mark...
true
f7e598120c27a68051abe7270ccf9e9720370228
Ruby
kinsona/assignment_self_associations
/movies/db/seeds.rb
UTF-8
768
2.578125
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 rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
true
98b152cc82b852de0aba283aa29208a5693589a6
Ruby
sochetanie/object-relations-assessment-web-042417
/solution.rb
UTF-8
1,326
3.375
3
[]
no_license
# Please copy/paste all three classes into this file to submit your solution! class Customer attr_accessor :first_name, :last_name @@all = [] def initialize(first_name, last_name) @first_name = first_name @last_name = last_name @@all << self end def full_name "#{first_name} #{last_name}" ...
true
f5c4baad921358af8d167e21abac5b3d567d9fc8
Ruby
captproton/mephisto-support
/mephisto_flickr_photo_stream/test/unit/flickr_picture_liquid_test.rb
UTF-8
2,264
2.625
3
[]
no_license
require 'test/unit' require File.dirname(__FILE__) + '/../../../../../test/test_helper' require File.dirname(__FILE__) + '/../mocks/flickr_aggregation' class FlickrPictureLiquidTest < Test::Unit::TestCase def test_should_generate_correct_address_for_each_image_size pic = FlickrAggregation::Picture.new(:title ...
true
b87f99b8980b380aadc05a35ff3f893988aa48e1
Ruby
natjng/sinatra-logging-in-and-out-online-web-ft-051319
/app/helpers/helpers.rb
UTF-8
401
2.984375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Helpers # < Sinatra::Base def self.current_user(session) @user = User.find(session[:user_id]) @user end def self.is_logged_in?(session) !!session[:user_id] ? true : false # double bang will convert value to a boolean # without double bang, value will be ni...
true
a0616fd87b091b82f01986a662d7d813454a5a41
Ruby
jjmuteteke/ruby_chat
/app/models/conversation.rb
UTF-8
1,629
2.53125
3
[]
no_license
#this class will model the conversations of the users class Conversation < ActiveRecord::Base #these two lines indicate that the conversation belongs to both a sender and a recipient which are both users #as you can see the foriegn keys link to the sender and receiver belongs_to :sender, :foreign_key => :se...
true
7a33847a455c5957789d83acf2096dfbecbe79d3
Ruby
mximos/mangoapps_assignment
/app/models/concerns/rss_feedable.rb
UTF-8
865
2.671875
3
[]
no_license
require 'rss' require 'open-uri' module RssFeedable module ClassMethods end module InstanceMethods def recent_feeds! fetch_recent_feed! if @items.blank? end def fetch_recent_feed! open(url) do |rss| raw_feed = RSS::Parser.parse(rss) self.name ...
true
7b371cc43b21003bc6523162b97441dfe8babeb4
Ruby
Mrober202/RecordStoreProject_1
/models/album.rb
UTF-8
1,741
3.46875
3
[]
no_license
require_relative('../db/sql_runner') require_relative('./artist') class Album attr_accessor(:id, :artist_id, :title, :genre, :release_year, :stock_level, :cover, :buy_price, :sell_price) def initialize(options) @id = options['id'].to_i() @artist_id = options['artist_id'] @title = options['title'] ...
true