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
03597575bc9533f5e19f79dac825829bde07c7f1
Ruby
tylerswartz/ga_bewd
/class-work/lab_reddit_jeffs/lib/story.rb
UTF-8
373
2.9375
3
[]
no_license
class Story   attr_accessor :title, :upvotes, :url, :site   def inialize     @title = title     @upvotes = upvotes     @url = url     @site = site   end   def headline(story)     puts "This story is called #{@title}. It has #{@upvotes} and came from #{@site} – you can access it by going to #{@url}\n"   end end
true
ccac8c1965b8bd0e98c061201501cc61f94d6571
Ruby
djkz/workflows-rails
/app/lib/domains/shopping/books.rb
UTF-8
570
2.78125
3
[]
no_license
module Domains module Shopping class Books attr_accessor :user def initialize(user) self.user = user end def find(id) book = Book.find(id) purchase = Purchase.find_by(user: user, book: book) book = purchase ? (book.becomes PurchasedBook) : ...
true
661f7a302d15c5ccdc498029d5b6a1ecc2f4a4f3
Ruby
sinisterchipmunk/rink
/lib/rink/input_method/readline.rb
UTF-8
1,301
2.5625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
begin require 'readline' module Rink module InputMethod class Readline < Rink::InputMethod::Base attr_accessor :completion_append_character, :completion_proc, :prompt def initialize(completion_proc = proc { |line| [] }) super() @completion_append_...
true
1a1f375d437f3e12a0843111a1408e689709a4ca
Ruby
mgiagante/ruby_building_blocks
/caesar_cipher/caesar_cipher.rb
UTF-8
1,213
4.75
5
[ "MIT" ]
permissive
# This Caesar Cipher implementation uses a Ring enumerator wrapper that handles end of iteration by rewinding its enumerator to achieve the circular iteration behavior. class Ring def initialize(collection) @enum = collection.each end def next begin @enum.next rescue StopIteration @enum.r...
true
b3593d9edbfbc76fe1858507a3edd0a436399a90
Ruby
davidmorton0/chemistry_quiz
/test/integration/factories_test.rb
UTF-8
4,009
2.53125
3
[]
no_license
require 'test_helper' class FactoriesTest < ActionDispatch::IntegrationTest test "should create a valid answer" do answer = create(:new_answer) assert answer.valid? end test "should create a valid question" do question = create(:new_question) assert question.valid? end test "should c...
true
828e90b3d19e4decc085b096e6b25d7acacfcb85
Ruby
Sunny17544/Grey-Campus
/[Daily Report] 19th May 2021/RubyMonk Programs/Singleton method.rb
UTF-8
172
3.375
3
[]
no_license
# Write a ruby program to demonstrate singleton method class Foo end foo=Foo.new def foo.shout puts "Sunny Sunny Sunny!" end foo.shout p Foo.new.respond_to?(:shout)
true
2284b7a1850bb7a886981c5d48e35ba31caf8bbd
Ruby
codeunion/topics-in-cs
/session-notes/2015-01-29/linked_list.rb
UTF-8
1,675
3.90625
4
[]
no_license
class LinkedList attr_reader :value attr_accessor :next # We have to use "rest" as the argument name because "next" # is a reserved keyword in Ruby. def initialize(value, rest = EmptyList.new(nil)) @value = value @next = rest end def each(&block) node = self until node.empty? bloc...
true
9aa847e29f59584436c912e0d30b87dfb30a4d62
Ruby
AliSchlereth/root_and_branch
/spec/models/cart_spec.rb
UTF-8
1,376
2.84375
3
[]
no_license
require 'rails_helper' describe "cart model tests" do before :each do @cart = Cart.new({"1"=>1}) end scenario "cart can initialize with contents" do expect(@cart.contents).to eq({"1"=>1}) end scenario "can add items to contents" do @cart.add_item(1) expect(@cart.contents).to eq({"1"=>2}) ...
true
c2dfd83e215f2ceeb7dc5ef156143a4578c604a8
Ruby
emaglio/trailblazer-test
/lib/trailblazer/test/operation/helper.rb
UTF-8
683
2.515625
3
[]
no_license
module Trailblazer::Test module Operation module Helper def call(operation_class, *args) call!(operation_class, args) end def call!(operation_class, args, raise_on_failure:false, &block) operation_class.(*args).tap do |result| if !result.success? yield resu...
true
5a0b5ada3da9548772995d08d42f71a0db26d83c
Ruby
ratnikov/exemplar
/lib/exemplar/example.rb
UTF-8
1,131
3.234375
3
[ "MIT" ]
permissive
module Exemplar class Example include Loggable class << self def before_callbacks @before_callbacks ||= [] end def before(*before_methods) before_callbacks.push *before_methods end def examples @examples ||= [] end end attr_reader :name, ...
true
1d761aa64ea55b7f1a1316f7471c0b60c70155cf
Ruby
hunglethanh9/leetcode
/26. Remove Duplicates from Sorted Array/Remove Duplicates from Sorted Array.rb
UTF-8
197
3.390625
3
[]
no_license
# @param {Integer[]} nums # @return {Integer} def remove_duplicates(nums) i=0 nums.each_with_index do |num,index| if nums.index(num) == index nums[i] = num i +=1 end end return i end
true
748ec0d5bc02374f929f943dc8d104c129e116f0
Ruby
pnc/matches
/spec/match_method_spec.rb
UTF-8
2,364
2.546875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe MatchMethod do it "should store its matcher" do mm = MatchMethod.new(:matcher => /foo/) mm.matcher.should == /foo/ end it "should know if a message matches" do mm = MatchMethod.new(:matcher => /find_by_(\w+)/) mm.matche...
true
99a2020e55c703cdef1ee912c757c5780b20aeba
Ruby
vishavishal/selection_info
/vg_selection_info/core/component_info.rb
UTF-8
6,536
2.5625
3
[]
no_license
#---------------------------------------------------------------------------------- # CopyRight : Vivek Gnanasekaran # Main module containing the functions for the Component details of the selection # #---------------------------------------------------------------------------------- module VG_SITool_V1 module Co...
true
b96a9da86fca9e22a1f367ee8fecb49d107f299b
Ruby
elizaplowden/inheritance-lecture
/restaurant.rb
UTF-8
1,028
3.65625
4
[]
no_license
require_relative 'chef' class Restaurant attr_reader :name, :city, :chef attr_accessor :capacity def initialize(name, city, category, capacity, chef_name) @name = name @city = city @category = category @capacity = capacity @chef = Chef.new(chef_name, self) @clients = [] end def open...
true
2ff2b521d1670afeaf987654b661304cb002ac61
Ruby
Taishawnk/oo-banking-online-web-pt-120919
/lib/bank_account.rb
UTF-8
386
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class BankAccount attr_reader:name attr_accessor :status,:balance def initialize(name) @name=name @status="open" @balance = 1000 @@all=[] end def deposit(deposit) @balance+=deposit end def display_balance "Your balance is $#{@balance}." end def valid? @balance > 0 && status=="op...
true
3b02d73615d6febe4110c9f3960025b57e4da0e8
Ruby
RSRBX07/exo-didier
/lib/song.rb
UTF-8
1,256
3.171875
3
[]
no_license
=begin Allongeons la jambe Chanson de marche Ma poul' n'a plus qu' vingt-neuf poussins, Ma poul' n'a plus qu' vingt-neuf poussins, Elle en avait trente. Allongeons la jambe, Allongeons la jambe, la jambe Car la route est longue. Allongeons la jambe, la jambe Car la route est longue. Ma poul' n'a plus qu' vingt-huit po...
true
1e96dd46576c2f8675cd967137966fbf5f276a91
Ruby
agoodman/icoast
/lib/position_normal_strategy.rb
UTF-8
780
2.9375
3
[]
no_license
module PositionNormalStrategy # calculates normal vector based on previous and next positions # assumes post and enabled # returns a two-element array: [x,y] # returns nil if unable to determine normal def self.normal_for(image) count = Image.post.enabled.count prev_image = Image.post.enabled.where(p...
true
9b1965c55cf26eb9d3af7a3840cde3a81ab667cb
Ruby
changamanda/flatiron_scheduler
/lib/flatiron_scheduler.rb
UTF-8
2,243
2.828125
3
[]
no_license
require 'path_setup' require 'git_helper' class FlatironScheduler include PathSetup extend GitHelper attr_reader :week, :day, :path def initialize(week, day) @path = read_path @week = week @day = day end ## INSTANCE METHODS def file_name "week-#{week}/day-#{day}.md" end def add_co...
true
2f98f817e87d553bd3a977e977ccfb2221aa806d
Ruby
motri/bank
/lib/balance.rb
UTF-8
262
3.390625
3
[]
no_license
# It understands account balance class Balance attr_accessor :total def initialize @total = 0 end def add(amount) @total += amount end def deduct(amount) raise 'Insuficient funds.' if @total - amount < 0 @total -= amount end end
true
e4f44f0a6ea5763fd0a1d6f3c70b4b468cb5d028
Ruby
chihungyu1116/euler_project_problem_solutions
/euler_p2_sol.rb
UTF-8
537
3.9375
4
[]
no_license
# problem 2 # Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-value...
true
760df353fc673008288534dc1c75d53d641a3b7e
Ruby
VorontsovIE/whysoserious
/add_osn.rb
UTF-8
517
2.53125
3
[]
no_license
require 'csv' raise unless filename = ARGV[0] # tbl = CSV.read(filename, col_sep:"\t", headers: :first_row) tbl = File.readlines(filename).map{|row| row.chomp.split("\t") } hdr = tbl.shift tbl = tbl.map{|l| l + ['-'] * (hdr.size - l.size) } idx = hdr.index('okved_osn_code') puts [*hdr, 'osn_1', 'osn_1_2'].join("\t")...
true
bdb591cfc480c0642129a42165964c468a1a355a
Ruby
pombredanne/Ruby-to-JavaScript-translator
/sample/crazy_fibonacci.rb
UTF-8
285
3.890625
4
[]
no_license
def fibonacci(n = 1) if n == 1 return 1 elsif n == 0 return 1 else return fibonacci(n - 1) + fibonacci(n - 2) end end n = 0 x = [1, 2, 3, 4, 6, 7, 8, 9, 0, 4] while n < 10 do puts ((fibonacci(x[n]) % 5) ** 3) n += 1 end
true
f345cb04153b9c9b1c9a966dc6f3b8e588874236
Ruby
qicaisheng/cash_register
/lib/cash_register.rb
UTF-8
1,815
2.8125
3
[]
no_license
require 'commodity_record' require 'promotion' require 'shopping_item' module CashRegister class << self attr_reader :shopping_list, :barcode_array def perfom(barcode_array = nil) @barcode_array = barcode_array CommodityRecord.refresh scan_shopping_commodities print_shopping_list ...
true
671453dae89f637f55976a30ced3890194580d7d
Ruby
bitex-la/bitex-ruby
/lib/bitex/usd_deposit.rb
UTF-8
4,088
2.734375
3
[ "MIT" ]
permissive
module Bitex # A deposit of USD to your bitex.la balance. # class UsdDeposit # @!attribute id # @return [Integer] This UsdDeposit's unique ID. attr_accessor :id # @!attribute created_at # @return [Time] Time when this deposit was announced by you. attr_accessor :created_at # @!at...
true
8c473a8129de999609476c10c3d21ea7a78fe468
Ruby
ConorOwens/reverse-each-word-online-web-prework
/reverse_each_word.rb
UTF-8
150
3.515625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(string) array = string.split(" ") reverse = [] array.collect do |x| reverse << x.reverse end reverse.join(" ") end
true
8b0df8c77ba2bcfd7f1cf6bd87a58c7ecfdc0d2f
Ruby
mtn/almond
/src/parser.rb
UTF-8
3,613
3.25
3
[ "MIT" ]
permissive
require_relative 'errors' require_relative 'lexer' require_relative 'expr' require_relative 'env' class Parser def initialize(tokens) @tokens = tokens @ind = 0 end def advance @ind += 1 end def parse(token) raise UnexpectedEOF if not @tokens[@ind] raise Une...
true
5d413f6697e19568b96a0840ea050c11062399d3
Ruby
studentinsights/studentinsights
/spec/lib/transition_note_parser_spec.rb
UTF-8
1,467
2.703125
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
require 'spec_helper' RSpec.describe TransitionNoteParser do describe '#parse_text' do it 'works' do text = "What are this student's strengths? everything!\n\nWhat is this student's involvement in the school community like? really good\n\n\n\n\nHow does this student relate to their peers? not sure\n\nWho...
true
e20e337541d9ddda5792e348d826b75e8ace3733
Ruby
StephanieCunnane/Launch_School_Course_130
/exercises/medium_1/text_analyzer.rb
UTF-8
1,447
3.453125
3
[]
no_license
TEXT = <<~TEXT Eiusmod non aute commodo excepteur amet consequat ex elit. Ut excepteur ipsum enim nulla aliqua fugiat quis dolore do minim non. Ad ex elit nulla commodo aliqua eiusmod aliqua duis officia excepteur eiusmod veniam. Enim culpa laborum nisi magna esse nulla ipsum ex consequat. Et enim et quis excepteur tem...
true
fd64d532d28552125dd13248abea7dcd0c1b2e1f
Ruby
CoderNight/tampa-coder-night-002
/005/spec/scrabble_printer_spec.rb
UTF-8
563
2.9375
3
[]
no_license
require_relative '../lib/scrabble_printer' describe ScrabblePrinter do let(:game) do board = ScrabbleBoard.new board[0,0] = 1 board[1,0] = 3 board[0,1] = 2 board[1,1] = 4 dictionary = %w{by at xy} tiles = ScrabbleTiles.new tiles.add_tile("a", 5) tiles.add_tile("b", 12) tiles...
true
5497298b6480174c62b3cbc71e19c50470b58a04
Ruby
maiha/typed
/spec/time_spec.rb
UTF-8
797
2.578125
3
[ "MIT" ]
permissive
require "spec_helper" describe Typed::Hash do let(:data) { Typed::Hash.new } describe "#time" do it "should return a Time when it is a Fixnum" do data["now"] = Time.mktime(2012,5,15).to_i data.time("now").should == Time.mktime(2012,5,15) end it "should return itself when it is a Time" do ...
true
d8008b1bd3c0952ee1caeaa5ff253e056175c08f
Ruby
stmosher27/app-
/Scott_Mosher/w1/w1d4/exercises/lib/01_book_titles.rb
UTF-8
332
3.53125
4
[]
no_license
class Book # TODO: your code goes here! SMALL = %w(a the an and in of) attr_reader :title def title=(title) arr = title.split(" ") arr.each.with_index do |word, i| if SMALL.include?(word) && i != 0 word else word.capitalize! end end @title = arr.join(" "...
true
61b55297fff19d7ffe14b57d04fa11248c2c1166
Ruby
sghosh23/wimdu-test
/app/my_app.rb
UTF-8
3,057
3
3
[]
no_license
#app/my_app.rb require "thor" class MyApp < Thor desc "Starting with new property ABC1DEF2", "Please Enter the credentials of your new property!" def new output = [] title = ask("Title for your property: ") title_pro = ask_title title output << "title: "+ title_pro property_type = ask_prope...
true
9ff2f8170cb1a002a3803af431b953609f66f75f
Ruby
HungryAnt/ruby-game
/src/viewmodels/game_modules/game_monster.rb
UTF-8
2,249
2.53125
3
[]
no_license
module GameMonster def init_monsters @monsters_service.register_monster_msg_callback do |monster_msg| area_id = monster_msg.area_id item_map = monster_msg.item_map detail = monster_msg.detail area_vm = @map_service.get_area(area_id) monster_id = item_map['id'] quiet = !...
true
c63dc5658b68fbea6f8a8876d11ed12683e53e50
Ruby
CamilleBonnet/santa_2019
/day_6/day6.rb
UTF-8
843
2.953125
3
[]
no_license
class Day6 def self.process(input) compute_path_to_COM(input) @orbit_path.values.flatten.size end def self.compute_santa_path(input) compute_path_to_COM(input) meeting_point = (@orbit_path["SAN"] & @orbit_path["YOU"]).first min_path = @orbit_path["SAN"].index(meeting_point) + @orbit_path["YOU...
true
0e2ccdf4759f5b0dd304cd5128af27438e5b8afd
Ruby
edwin0258/PracticeApp
/test/models/post_test.rb
UTF-8
680
2.65625
3
[]
no_license
require 'test_helper' class PostTest < ActiveSupport::TestCase def setup @post = Post.new(title: "The world is mine", summary: "A brief journey through my life", body: "I was born and then things happened and now I am here test test test.", user_id: 1) end test "Post should be valid" do assert @post.valid? ...
true
ccc2db9a1d2383d38f4f7b5da4843105fe17aaa3
Ruby
OlafLewitz/software_zero
/spec/ruby_ext/string_spec.rb
UTF-8
1,198
3.0625
3
[]
no_license
# encoding: UTF-8 require_relative "../../config/initializers/string" def section (comment) $section = comment $counter = 0 end def test (given, expected) describe "#{$section}: Test ##{$counter+=1}" do it "should convert the string #{given.inspect} to the slug #{expected.inspect}" do given.slug(:page...
true
77ab79c63eb28c8f3dd4e23524e530c1fd4e4a25
Ruby
levinalex/lawdiff
/lib/lawdiff.rb
UTF-8
1,110
2.53125
3
[]
no_license
require 'nokogiri' module Lawdiff class Patch def initialize(xml) @xml = xml end def document_name @xml["document"] end def apply(store) document = store[:example] @xml.elements.each do |elem| add(document, elem) end return store end def a...
true
38f1654d08e39486efa83c97df417a8ee29e3e34
Ruby
Alena29/QA
/HW_17/script_17_08.rb
UTF-8
959
3.515625
4
[]
no_license
#================================================================================================== # Script = script_17_08.rb #================================================================================================== # Description = Command line options(4): -a Spring -b Summer -c Fall -...
true
f4df7e43aed1b1c31e71a9e3150967a8c64a2d31
Ruby
orbanbotond/problem-or-not
/app/models/highlighter.rb
UTF-8
612
2.53125
3
[]
no_license
module Highlighter def highlight(orig, search_string) return orig if search_string.strip.empty? string_unaccented = orig.unaccent r = Regexp.new "(#{search_string.unaccent.split.join('|')})", true search_array = string_unaccented.to_enum(:scan, r).map do |x,| [$`.size, $`.size + x.size - 1] ...
true
efc32d158aa585af17366f70e1e101583c90b69d
Ruby
Teapane/exercism
/ruby/strain/array.rb
UTF-8
233
2.75
3
[]
no_license
class Array def kept canidate = [] each {|canidate| kept << canidate if yield(canidate)} canidate end def discard incumbent = [] each {|incumbent| <<incumbent unless yield(incumbent)} incumbent end end
true
35965296455360ef78e1d28ed8708b60e86f2c68
Ruby
jmettraux/knight-path
/lib/kp.rb
UTF-8
1,216
3.75
4
[ "MIT" ]
permissive
class Square attr_reader :x, :y def initialize(x, y) @x = x @y = y end def ==(s) s.is_a?(Square) && s.x == @x && s.y == @y end def distance(s) #Math.sqrt((s.x - @x) ** 2 + (s.y - @y) ** 2) # no need to compute the square root... (s.x - @x) ** 2 + (s.y - @y) ** 2 end def knight...
true
eaf2c92cdd95c9caa1ae27e42a6a357158d5a742
Ruby
rud/amrita
/lib/amrita/template.rb
UTF-8
10,126
2.609375
3
[ "LicenseRef-scancode-other-permissive" ]
permissive
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') require 'amrita/node.rb' require 'amrita/node_expand.rb' require 'amrita/format.rb' require 'amrita/compiler.rb' require 'amrita/parser.rb' module Amrita module CacheManager Item = Struct.new(:type, :filename, :key, :mtime, :contents) def cache(file...
true
b94a36c6a28b49a4c53130bca16dfbab8a796338
Ruby
Jeantirard/TheHackingProject2018
/semaine0/Vendredi/pyramide.rb
UTF-8
392
3.296875
3
[]
no_license
puts "Salut Mr l'utilisateur, bienvenue dans ma super pyramide ! Combien d'étages veux-tu ?" print "~: " number_floors = gets.to_i puts "Voici la piramide :" conteneur = number_floors i = 0 while (i <= number_floors) if (conteneur == number_floors) print "" else conteneur.times do print " " end end i.time...
true
54c43781769ee71ada00bbc3f84a8a4f2d261dfc
Ruby
christianzam/fibonacci_test.rb
/telos_fibonnaci.rb
UTF-8
1,171
4.125
4
[]
no_license
# TODO: Find the last digit of a partial sum of Fibonacci Numbers: Given two non-negative integers m and n, # where m <= n, find the last digit of the sum Fm + Fm+1 … + Fn def fibonacci(n,m) # raise an Error if number n or m is less than one fail ArgumentError, "# numbers must be greater than 0" if n.zero? || m.z...
true
a44842b521d0c7b79da8e2a504d87e11fa87e337
Ruby
claytonchristian11/w3d5
/ActiveRecordLite1/lib/01_sql_object.rb
UTF-8
2,899
2.984375
3
[]
no_license
require_relative 'db_connection' require 'active_support/inflector' require 'byebug' # NB: the attr_accessor we wrote in phase 0 is NOT used in the rest # of this project. It was only a warm up. class SQLObject def self.columns return @columns unless @columns.nil? # table = self.table_name connections =...
true
533420a4d3811db3fef95a4a8b117f6bf39e8110
Ruby
grouphub/congo
/app/services/memberships/create_from_csv.rb
UTF-8
1,200
3.125
3
[]
no_license
require 'csv' module Memberships class CreateFromCSV def self.call(*args) new(*args).process end attr_reader :csv_file_rows, :csv_file_headers, :group def initialize(csv_file, group) @csv_file_rows = CSV.read(csv_file) @csv_file_headers = headers_from_csv_file @group ...
true
7699a7b4edf69d1be966684848ab67c46f8795a5
Ruby
NRodriguez17/interactive_resume
/app/models/extracurriculars.rb
UTF-8
812
2.8125
3
[]
no_license
class Extracurriculars attr_accessor :extracurricular1, :dates1, :description1, :description2, :extracurricular2, :dates2, :description3, :description4, :extracurricular3, :dates3, :description5, :description6 def initialize(extracurricular1, dates1, description1, description2, extracurricular2, dates2, descript...
true
9110aade1f5a91cc76e8535edb75a46a70534785
Ruby
torandi/krypto12
/code/homeworkA/tarandi_andreas/coincidence.rb
UTF-8
2,664
3.515625
4
[]
no_license
## # This program calculates the index of coincidence and related data # Usage: ruby coincidence.rb input_file # Author: Andreas Tarandi - taran at kth dot se ##### # SETTINGS ##### #key_len_range = (1..18) key_len_range = [18] alphabet = "#ABCDEFGHIJKLMNOPQRSTUVWXYZ_" # Set to true to calculate probability distrub...
true
15f1a3aa63bedb731cbcc2342b68bacfe50d2735
Ruby
avaio-vrn/template-system
/app/models/files/upload.rb
UTF-8
975
2.640625
3
[ "MIT" ]
permissive
class Files::Upload attr_reader :filename def initialize(args) @file = args[:file] @filename = filename_get(args[:filename]) @dir = directory_get(args[:directory]) end def save begin File.open(file_fullpath, "wb") { |f| f.write(@file.read) } rescue nil end end private ...
true
42c253b57f70e31fedc052c67b112393b8e598ae
Ruby
kevinjxx/zipline
/lib/zipline/fake_string.rb
UTF-8
268
2.578125
3
[ "MIT" ]
permissive
module Zipline #this pretends to be longer than it is class FakeString < String attr_accessor :fakesize #don't let to_s let people def to_s self end def bytesize @fakesize end def length @fakesize end end end
true
ebf685e5fb248fb29556c8340e5073e43c184054
Ruby
gpcucb/final-opengl-project-sergiosergito
/color.rb
UTF-8
114
2.875
3
[]
no_license
class Color attr_accessor :red, :green, :blue def initialize @red = 1.0 @green = 1.0 @blue = 1.0 end end
true
0ae88ac2b25fd600b2a97d5fd85133ddd15c6499
Ruby
NicholasBuczacki/launch-school
/exercises/small_problems/easy1/list_of_digits.rb
UTF-8
488
4.34375
4
[]
no_license
#Write a method that takes one argument, a positive integer, and returns a list of the digits in the number. #Examples: #puts digit_list(12345) == [1, 2, 3, 4, 5] # => true #puts digit_list(7) == [7] # => true #puts digit_list(375290) == [3, 7, 5, 2, 9, 0] # => true #puts digit_list(444) == [4...
true
902e86315ac6072ae5b565b84fcb0f6b561d0f5e
Ruby
dennisnderitu254/toy-problem-FizzBuzz
/script27.rb
UTF-8
204
3.84375
4
[]
no_license
#FIZZBUZZ toy problem for num in 1...100 puts num num = gets.chomp if num % 3 and 5 == 0 puts "FizzBuzz" elsif num % 3 == 0 puts "Fizz" elsif num % 5 == 0 puts "Buzz" else puts num end end
true
d1d34c2468adbacbc1d0b3601b6b9fddd261a222
Ruby
rvelarden/programming-univbasics-nds-nested-arrays-iteration-lab-part-2-nyc01-seng-ft-071320
/lib/iteration_with_loops.rb
UTF-8
185
3
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def find_min_in_nested_arrays(src) min_array = [] count_1 = 0 while count_1 < src.length do min_array.push(src[count_1].min) count_1 += 1 end min_array end
true
fca67de03f16aa1e2d8b95458f5fbc7fe185e079
Ruby
tannerwelsh/code-training
/ruby/Learn to Program/orange_tree.rb
UTF-8
1,354
4.0625
4
[ "MIT" ]
permissive
class OrangeTree def initialize @age = 0 @height = 0 @num_oranges = 0 end def count_the_oranges if @num_oranges == 0 puts 'There are no oranges right now.' else puts "There are #{@num_oranges} oranges on the tree." end one_year_passes end def pick_an_ora...
true
b80d7e3eec9c15a8c578b98c3d836f3c25b9dfdd
Ruby
rkorzeniec/countryfier
/lib/countries/currencies_updater.rb
UTF-8
800
2.765625
3
[]
no_license
# frozen_string_literal: true module Countries class CurrenciesUpdater include ::Countries::UpdaterLogger LOG_COLUMNS = %w[country_id code name symbol].freeze def initialize(country:, data:) @country = country @data = data end def call data.each do |currency_data| cur...
true
f0a6f0084dfc1e3a0d9cc08022f7e59c2f88e3ab
Ruby
orderedlist/solidus
/core/app/models/spree/order_cancellations.rb
UTF-8
3,973
2.578125
3
[ "BSD-3-Clause" ]
permissive
# This class represents all of the actions one can take to modify an Order after it is complete class Spree::OrderCancellations extend ActiveModel::Translation # If you need to message a third party service when an item is canceled then # set short_ship_tax_notifier to an object that responds to: # #call(u...
true
4ae24fbd5f5f69a8543cc1d04e463180e9c195f3
Ruby
ZachBeta/project_euler
/problem_20/problem_20.rb
UTF-8
391
4.125
4
[]
no_license
=begin n! means n (n 1) ... 3 2 1 For example, 10! = 10 9 ... 3 2 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. Find the sum of the digits in the number 100! =end def factorial(n) (1..n).inject(:*) || 1 end factorial_string = factorial(100).to_s sum = 0 ...
true
9f0d1e93ba5ad3ca9d9644b1bc256389f50653ea
Ruby
ShaunMackie/Ruby_Small_Problems
/Easy_7/Easy7_1.rb
UTF-8
227
4.03125
4
[]
no_license
def interleave(arr1, arr2) new_array = [] arr1.length.times do new_array << arr1.shift new_array << arr2.shift end new_array end p interleave([1, 2, 3], ['a', 'b', 'c']) == [1, 'a', 2, 'b', 3, 'c']
true
67f2f8170f2671853fad5859149e57ea4e370192
Ruby
teralad/eventmoo
/app/utilities/data_gobblers/booking_csv_row.rb
UTF-8
1,169
2.515625
3
[]
no_license
class BookingCsvRow @@cache = ActiveSupport::Cache::MemoryStore.new() def initialize(data, event) @event = event @rsvp = data @booking_obj = [] process_rsvp end def bulk_insert_bookings! Booking.import! @booking_obj, validate: false end private def get_and_store_user_id(username) ...
true
d035b9f57f090743b5efb423ae731c75eb0812b5
Ruby
k-solutions/market-data
/spec/support/rankables.rb
UTF-8
2,358
2.9375
3
[ "MIT" ]
permissive
shared_examples_for "rankable data" do let(:rankable) { described_class.new } it "has ranks" do expect(rankable.ranks).to be end describe "#rank!" do context "when rank value is between 0 and 1" do it "sets a named rank" do rankable.rank!(:test, 0) expect(rankable.ranks[:tes...
true
31148e09214a3fcf7342bf47e45b233698ce9c0b
Ruby
WebDevFromScratch/todo-app
/app/models/user.rb
UTF-8
1,212
2.796875
3
[]
no_license
class User < ActiveRecord::Base has_many :tasks has_many :user_categories has_many :categories, through: :user_categories has_secure_password # default validations were left (auto confirm validation) validates :username, presence: true, uniqueness: true, length: { minimum: 4 } validates :password, length:...
true
0da9f3be425b899f7feaf499d1cbd44b1e334eac
Ruby
abschreiber/CATS
/lessons_learned.rb
UTF-8
5,587
3.078125
3
[]
no_license
#! /usr/bin/env ruby require_relative 'lib/colors' puts "Which class did you take this week? ".green question_one = gets.chomp.to_s puts "\n" + "Oh! I hear that was the best class (way better than Jeremy's)".green + "\n" + "\n" + "Did you learn basic programming concepts? ".green question_two = gets.chomp.to_s ...
true
bf5d37ee01a04a32af06d7c6cbf01fc397274852
Ruby
antimag/resume_app
/spec/lib/resume_spec.rb
UTF-8
1,712
2.78125
3
[]
no_license
require 'resume' describe Resume do let(:education_name) { "Graduation test" } let(:collage_name) { "NSCB Govt PG Collage Biaora" } let(:percent) {"75"} let(:university){"Barkattullah university Bhopal"} let(:title) { "Project 1 test" } let(:description) { "Project description" } before do file = Fil...
true
3931ea50badb9ceddfd204b69735e27ade302fd3
Ruby
Govan/textexpander-sequence
/test/sequence_test.rb
UTF-8
1,378
2.9375
3
[ "MIT" ]
permissive
require 'rubygems' require 'shoulda' require '../sequence.rb' class SequenceTest < Test::Unit::TestCase context "Given a new sequence (with the default formatter), it " do setup { @sequence = Sequence.new @sequence.restart } teardown { FileUtils.rm(@sequence.file) } ...
true
600845dd8f541cbc6fe0f5e99ce01cfdb7fcf266
Ruby
mcwaller422/Intro_to_Ruby
/Hashes/Exercises/ex7.rb
UTF-8
141
3.375
3
[]
no_license
x = "hi there" my_hash = {x: "some value"} my_hash2 = {x => "some value"} #my_hash2 uses the variable x, whereas my_hash uses the symbol x.
true
85f071f59af549e290c00d1f249487564a14b55c
Ruby
dustyleary/langproto
/lang.2/test.10.struct.rb
UTF-8
881
2.734375
3
[]
no_license
#!/usr/bin/env ruby require './driver' test_compile [24,"1 Hello World 0000002a!\n"], <<eot (defstruct st_blah (int_field i32) (char_field i8) ) (define (main () i32) (var foo st_blah) (set! (struct-field foo int_field) 42) (printf "1 Hello World %08x!\n" (get (struct-field f...
true
a5d95c9ef2d4184f82d29b4af326800e5a2e600a
Ruby
bergren2/konigsberg-ruby
/test/lib/collatz_test.rb
UTF-8
434
2.625
3
[]
no_license
require "test_helper" require "collatz" class CollatzTest < Minitest::Test parallelize_me! def test_to_s # Arrange c = CollatzNode.new(13) # Act s = c.to_s # Assert assert_equal "13", s end def test_predecessors # Arrange c = CollatzNode.new(16) # Act p = c.predeces...
true
2fa39e00f518c050ac19f33e21a1a2f803c7e165
Ruby
epitron/upm
/lib/upm/freshports_search.rb
UTF-8
972
2.53125
3
[ "WTFPL" ]
permissive
require 'open-uri' require 'upm/colored' class FreshportsSearch NUM_RESULTS = 20 SEARCH_URL = "https://www.freshports.org/search.php?query=%s&num=#{NUM_RESULTS}&stype=name&method=match&deleted=excludedeleted&start=1&casesensitivity=caseinsensitive" SVN_URL = "svn://svn.FreeBSD.org/ports/head/%s/%s" def p...
true
dadeb189841ebe37cc11a8cca29adcfae22e2b71
Ruby
mindovermiles262/algorithms
/lib/build_tree.rb
UTF-8
2,434
3.5625
4
[ "MIT" ]
permissive
class BuildTree require './lib/node' attr_accessor :root_node def initialize(array) @root_node = nil build_tree(array) end def breadth_first_search(query) # Visit all nodes at the same level before visiting nodes at next deeper # level. Enqueues left then right ch...
true
fa5410ff50000f102ce2fc355d992772328520d7
Ruby
RomanKaasa/basic-ruby-script
/rubylab1.rb
UTF-8
404
4.21875
4
[]
no_license
puts "Hello, what's your name?" name = gets.chomp puts "Nice to meet you " + name puts "How old are you " + name + "?" age = gets.chomp.to_i age_min = age * 365 * 25 * 60 puts "Your're " + age.to_s + " years old. That's " + age_min.to_s + " minutes!" puts "Whats the temp today?" temp = gets.chomp.to_i temp_c =...
true
f78c53ae9a468e2742cb6bb5040bc6aee596c8b9
Ruby
SeaWar741/ComputerSIB
/4to_semestre/word.rb
UTF-8
730
3.703125
4
[]
no_license
word = "perro" times = 0 letter = "" election = 0 telection = 0 uword = "" p "Adivina la palabra" p "Tendras 5 oportunidades para adivinar la palabra" while times < 5 p "Elegir si deseas ver una pista o adivinar la palabra, solo tendras 2 pistas" election = gets.chomp if election.to_i == 1 && telection...
true
bfbcf7f6c234a2f8f964aebabbd9f6f60af0f2b0
Ruby
Zamzy/rubybook_practices_zamzy
/4/10.rb
UTF-8
67
3.234375
3
[]
no_license
sum = 0 a = [1, 2, 3] a.each do |x| sum = sum + x end puts sum
true
20bb9eb31b38e113c56d5479f35e1b1387151e45
Ruby
DonkeyFish456/address-bloc
/spec/entry_spec.rb
UTF-8
963
2.765625
3
[]
no_license
require_relative '../models/entry' RSpec.describe Entry do describe "attributes" do let(:entry) {Entry.new('Ada Lovelance', '010.012.1815', 'test@test.com')} it "responds to name" do expect(entry).to respond_to(:name) end it "reports its name" do expect(entry.name).to eq('Ada Lovelance'...
true
b4dfcef1effaad381de1e133c02341724b92b0e6
Ruby
ntallman/pitcher
/lib/pitcher.rb
UTF-8
2,337
2.65625
3
[ "BSD-3-Clause" ]
permissive
require 'pitcher/version' require 'pitcher/options' require 'savon' require 'csv' require 'nokogiri' module Pitcher class Pitcher attr_accessor :message # load the csv and parse def load_csv(file) metadata = File.open(file, 'r') metadata_parsed = CSV.new(metadata, :headers => true, :header_...
true
a15ddeb6f688c6d23a483997b3553faafe23da8d
Ruby
alieseparker/ruby_deck_o_cards
/lib/deck_of_cards.rb
UTF-8
386
3.390625
3
[]
no_license
class Deck @deck = [] def self.initialize values = %w[ Ace 2 3 4 5 6 7 8 9 10 Jack Queen King ] suits = %w[ Hearts Diamonds Clubs Spades ] suits.each do |suit| values.each do |value| @deck << "#{value} of #{suit}" end end end def self.identify_card (num) return @deck[n...
true
f5e496e23c21dba234104e439a2da7b5fbece7d5
Ruby
hiby90hou/code-practice
/ruby/interview/robot/spec/lib/controller_spec.rb
UTF-8
5,369
2.921875
3
[]
no_license
require "controller" RSpec.describe Controller do before :each do @controller = Controller.new(5,5) end context 'direction translate' do it "'NORTH' direction can be translate to '0'" do expect(@controller.direction_translate("NORTH")).to eq (0) end it "'EAST' direction can be translate to '90'" do ...
true
68d43f6299ec9811f4641d367fd8fff226b30d1e
Ruby
ExternalReality/rubyFizzBuzz
/fizzbuzz.rb
UTF-8
427
3.046875
3
[]
no_license
require 'contracts' class FizzBuzz include Contracts::Core include Contracts::Builtin Contract Nat => Or['Fizz', 'Buzz', 'FizzBuzz', /^[0-9]*$/] def call(number) divisibleBy3 = (number % 3 == 0) divisibleBy5 = (number % 5 == 0) case when divisibleBy3 && divisibleBy5 "FizzBuzz" when ...
true
0f5b04843d93bb5a3d3ebc60d72388b67558dc22
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/a9224c2cf48a409c9142ec73f877ea1f.rb
UTF-8
226
3.59375
4
[]
no_license
class Bob def hey(str) case when str.strip.empty? 'Fine. Be that way!' when str == str.upcase 'Woah, chill out!' when str.end_with?('?') 'Sure.' else 'Whatever.' end end end
true
3a727b1c9be7d6dc464fdf546f2382f93b5ffec2
Ruby
bradfeehan/advent-of-code-2019
/spec/08/image_spec.rb
UTF-8
1,707
2.59375
3
[]
no_license
# frozen_string_literal: true require File.join(ROOT, '8', 'image') RSpec.describe SpaceImage do subject(:image) { described_class.new(input, height: height, width: width) } context 'with example input 1' do let(:height) { 2 } let(:width) { 3 } let(:input) { '123456789012' } its(:checksum) { is_e...
true
84af7f8dd89a8791a22c8ef8bd769fcad2677a00
Ruby
jonmackeyparty/activerecord-validations-lab-online-web-sp-000
/app/models/post.rb
UTF-8
486
2.625
3
[]
no_license
class Post < ActiveRecord::Base validates :title, presence: true validate :clickbaits validates :content, length: { minimum: 250 } validates :summary, length: { maximum: 250 } validates :category, inclusion: { in: %w(Fiction Non-Fiction) } private def clickbaits if title titler = title.split("...
true
a426cc82dcbf9dfed7c6c1713ea43c35cdea1260
Ruby
jakemal/Ducksimulator2015i
/main.rb
UTF-8
923
2.765625
3
[]
no_license
require 'gosu' require_relative 'z_order' require_relative 'player' require_relative 'bread' class Main < Gosu::Window def initialize super 640, 400 self.caption = "Duck Sim 2015i" @background = Gosu::Image.new("media/skylandwater.png") @player_anim = Gosu::Image::load_tiles("media/duck.png", 255, 154)...
true
011ad8dc7eba60bd8de1debdbec96078f423a4c1
Ruby
zemariamm/Football-Sciencia
/ruby/gamestate.rb
UTF-8
820
3.234375
3
[]
no_license
class GameState include Enumerable def initialize @board = Array.new end def slice_by_scenes(scene1,scene2) @board[scene1.getTime .. scene2.getTime] end def add_event(scene,event) if @board[scene.getTime].nil? @board[scene.getTime] = {}.merge(event) else @board[scene.getTime...
true
ea17ab1661f3cb8790b74781a5d8a6e0407f48f6
Ruby
vbatts/rye
/try/35_basics_with_hop.rb
UTF-8
915
2.578125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'rye' ## a Rye::Hop instance defaults to localhost lhop = Rye::Hop.new "localhost" lhop.host #=> 'localhost' ## can set up arbitray port forwards from the hop, a give you the localport lhop = Rye::Hop.new "localhost" lhop.host lport = lhop.fetch_port("localhost", 22) lport.is_a?(Fixnum) #=> true ## Rye::Box...
true
0fba36721c3c0b2144f340afff152e46b08da3c0
Ruby
kurko/omniscient
/lib/shell/shell.rb
UTF-8
2,966
3.515625
4
[]
no_license
module Shell class Run # all arguments passed @argv def initialize argv @argv = argv @options = Shell::Parser.get_options @argv @command = Shell::Parser.get_command @argv @arguments = Shell::Parser.get_arguments @argv end end class Input ...
true
9a3275f83221934d720c3c31c1604702d60e6401
Ruby
akervern/taskWarrior-Mobile-Front-end
/TaskHelper.rb
UTF-8
1,941
3.0625
3
[]
no_license
class TaskSplitter TaskExec = "/usr/local/bin/task" @@userName = "arnaud" attr_accessor :columns def list res = `#{TaskExec} long`.split("\n") @columns = splitHead(res[2]) res end def detail(id) `#{TaskExec} info #{id}`.split("\n") end def addTask(task, project, dueDate) strProj...
true
729b0ae23d1a923b1b112edc1b0aa9762438a5d3
Ruby
tobyclemson/computational-physics
/lib/numerical_analysis/leapfrog_method.rb
UTF-8
3,616
3.71875
4
[]
no_license
require 'numerical_analysis/numerical_ode_solving_method' module NumericalAnalysis # Encapsulates the leapfrog method for numerical first order ODE solution. # An initial conditions vector is passed in along with a mathematical # object (either a matrix or a lambda representing a mathematical function # of...
true
93860b600e6c775b9d95bff070fd8c6df1f85edf
Ruby
PanchaTattva/irisvpn.com
/app/helpers/application_helper.rb
UTF-8
636
2.875
3
[]
no_license
module ApplicationHelper # If call returns body in response, you can get the deserialized version from the result attribute of the response def openstruct_to_hash(object, hash = {}) object.each_entry do |key, value| hash[key] = value.is_a?(OpenStruct) ? openstruct_to_hash(value) : value.is_a?(Array) ? arr...
true
a497bf2a844c1db99ab1f97aea25d4088d935f84
Ruby
pavlrd/takeaway
/lib/order.rb
UTF-8
284
2.84375
3
[]
no_license
require_relative 'menu_container' class Order include MenuContainer attr_reader :paid def initialize @paid = false end def total_to_pay(result = 0) dishes.each { |dish| result += dish[1][:price] } result end def receive_money @paid = true end end
true
304fb9df72842ee94a1f050474f4d87342675942
Ruby
livelink/binary-utils
/lib/binary/utils.rb
UTF-8
431
2.6875
3
[]
no_license
require "binary/utils/version" module Binary module Utils module_function def hex_to_bin(string) as_binary( [string].pack('H*') ) end def bin_to_hex(string) as_binary(string).unpack('H*').first end def as_binary(string) string = string.to_s if string.respond_to?(:for...
true
c6bbfd1a0208ee22be026e74f258abce856649e0
Ruby
darcys22/mav1
/app/models/motionless_agitator/employee_persister.rb
UTF-8
2,824
2.5625
3
[]
no_license
module MotionlessAgitator class EmployeePersister class << self def save(preferences) name = FullNameSplitter.split(preferences.name) Employee.create do |e| e.firstname = name[0] e.lastname = name[1] ...
true
0467970ffaa354c3dafc0904d81f2d0b92fb8895
Ruby
SergioETrillo/code_wars
/Ruby/8kyu/uniqueSum.rb
UTF-8
946
4.5
4
[]
no_license
=begin Given a list of integers values, your job is to return the sum of the values; however, if the same integer value appears multiple times in the list, you can only count it once in your sum. For example: [ 1, 2, 3] ==> 6 [ 1, 3, 8, 1, 8] ==> 12 [ -1, -1, 5, 2, -7] ==> -1 =end def unique_sum(lst) # Your ...
true
abb77b03413d803c0dc951732da0b1c3fca88122
Ruby
toddt67878/Course_Ruby
/ArrayII/The_sort_Method_on_an_Array.rb
UTF-8
206
3.125
3
[]
no_license
numbers = [5, 13, 1, -2, 8] words = ["caterpillar", "kangaroo", "Apple", "Zebra"] p numbers.sort p words.sort p numbers numbers.sort! p numbers booleans = [true, false, true, false] p booleans.reverse
true
8a9942e275e8e610dc891a8be2fd7a1745aa4c85
Ruby
Takada1993/rubyRPG
/battle.rb
UTF-8
2,773
3.390625
3
[]
no_license
#encoding: utf-8 # 戦闘クラス class Battle #attr_accessor :attack_point def initialize(player, monster) @player = player @monster = monster end def attack puts "----------" print "1を入力すると攻撃,2を入力すると回復,3を入力すると攻撃魔法 > " input = gets.chomp.to_i if (input == 1) lucky() case @nu...
true
121a3666d9565761bcdce5f03359e6bbd160e828
Ruby
EMDevelop/piggy_bank
/spec/piggy_bank_spec.rb
UTF-8
1,163
3.03125
3
[]
no_license
require 'piggy_bank' describe 'PiggyBank' do context 'User Story 1' do it 'Should be able to receive coins' do piggy_bank = PiggyBank.new expect(piggy_bank).to respond_to(:add).with(1).argument end it 'Should store coins when they are added' do piggy_bank = PiggyBank.new ...
true
0558663729bf339c10eccbcdf55b4e18de8a0e92
Ruby
Tomy8s/oystercard
/lib/journey.rb
UTF-8
466
3.453125
3
[]
no_license
class Journey MINIMUM_FARE = 1 PENALTY_FARE = 6 attr_reader :fare, :entry_station, :exit_station, :finish def initialize(station = nil) @entry_station = station @exit_station = nil end def complete? if entry_station.nil? || exit_station.nil? false else true end end d...
true
f1bc1c1f98daa47640e72c6fcd575e6d3f68b5de
Ruby
lonelyelk/lonelyelk_code
/recursive_regexp/brackets.rb
UTF-8
790
3.296875
3
[]
no_license
str = "1 + 2 * (3 - 4 / {5 + 6} + [7 - 8 * (9 + 10 * 11) + 12 * {13 - 14}] + 15) + 16 * (17 + 18)" re = %r{ (?<fill>[0-9+\-*/\s]+){0} (?<expression>\g<fill>*\g<brackets>\g<fill>*|\g<fill>){0} (?<braces>\{\g<expression>+\}){0} (?<squarebrackets>\[\g<expression>+\]){0} (?<parenthe...
true
237c32f3a95ea377cdfe86d23867dbe51734f47d
Ruby
eric-an/breathe-in
/lib/breathe_in/cli.rb
UTF-8
3,776
3.296875
3
[ "MIT" ]
permissive
class BreatheIn::CLI @@zipcode = nil def self.zipcode @@zipcode end def run puts "*Data provided courtesy of AirNow.gov*" puts "How safe it is to breathe today?" puts "" get_information check_site_availability menu end def get_information get_zipcode scrape_data i...
true
ebd619dd0767b5516d97313af83b767bfbd0b9a7
Ruby
lukekyl/ruby-enumerables-reverse-each-word-lab-online-web-prework
/reverse_each_word.rb
UTF-8
328
3.4375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(string) string_array = string.split(" ") reversed = string_array.each{|n| n.reverse!} return reversed.join(" ") end def reverse_each_word(string) string_array = string.split(" ") string_array.collect{|n| n.reverse!} return string_array.join(" ") end puts reverse_each_word("h...
true
b56c1ed26eae94db0686816ad19d23ca27f88fca
Ruby
colesayer/guided-module-one-final-project-web-082817
/app/models/gadget.rb
UTF-8
304
2.796875
3
[]
no_license
class Gadget < ActiveRecord::Base has_many :solutions has_many :obstacles, through: :solutions def self.formatted_names self.all.map do |gadget| gadget.name.split("_").map(&:capitalize).join(" ") end end def formatted_name self.name.split("_").map(&:capitalize).join(" ") end end
true