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
a79b6e926e202d5ae3683c123eb7a4ce787663ad
Ruby
radavis/dynamic_views
/hello_world.rb
UTF-8
117
2.765625
3
[]
no_license
require "sinatra" # root path get "/" do "Hello, World." end get "/hello/:name" do |name| "Hello, #{name}" end
true
06b1f781c8c08eeffe116e7bb8d34e1eb69f03a7
Ruby
samleb/rubinius
/spec/capi/language_spec.rb
UTF-8
1,301
2.65625
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require File.dirname(__FILE__) + '/spec_helper' load_extension('language') describe "CApiBlockSpecs" do before :each do @f = CApiBlockSpecs.new end it "identifies blocks using rb_block_given_p" do @f.block_given?.should == false (@f.block_given? { puts "FOO" } ).should == true end it "correc...
true
3ddfab265048a051907c8e4b0c1e4aa696152ba4
Ruby
Jennicode/desafio_hashes
/iter3.rb
UTF-8
432
3.09375
3
[]
no_license
def filter(hash, limite) hash_salida = {} hash.each do |k,v| if v > limite hash_salida[k] = v end end print hash_salida end hash = { Enero:15000, Febrero:22000, Marzo:12000, Abril:17000, Mayo:81000, Junio:13000, Julio:21000, Agosto:41200, ...
true
3c095f18811ec320ef93ee9d32f19420c969cac1
Ruby
rolftimmermans/syntaxtree
/lib/syntax_tree/events/control_structures.rb
UTF-8
1,080
2.5625
3
[]
no_license
module SyntaxTree module Events module ControlStructures def on_if(expression, expressions, else_block) expressions.left_delim = tokens.pop(:then) Ruby::IfExpression.new( left_delim: tokens.pop(:if), condition: expression, expressions: expressions, els...
true
b31f3260ca9429cec8e04c381547d84b7c08ad58
Ruby
rikuba/ruby-practices
/05.ls/ls.rb
UTF-8
6,388
3.171875
3
[]
no_license
#!/usr/bin/env ruby # frozen_string_literal: true require 'date' require 'etc' require 'optparse' # 全角半角を考慮した文字列幅を取得する+String#width+を定義する module StringWidth FULLWIDTH_REGEXP = /[^ [:ascii:] \uFF61-\uFF64 # Halfwidth CJK punctuation \uFF65-\uFF9F # Halfwidth Katakana variants ]/x.freeze refine Str...
true
47d819f00cbab24aecd5a7a6c654c19572583b43
Ruby
RodCardenas/AppAcademyProjects
/Cohort/Practice/a00/spec/a00_spec.rb
UTF-8
2,578
3.65625
4
[]
no_license
require 'rspec' require 'spec_helper' require 'a00' describe "#folding_cipher" do it "maps letters to the other side of the alphabet" do expect(folding_cipher("a")).to eq("z") expect(folding_cipher("d")).to eq("w") end it "encodes plaintext words" do expect(folding_cipher("hello")).to eq("svool") ...
true
d1fb93a0c7a91694ac65912e2ed4fa98b62ae704
Ruby
clane8/blog
/lib/app.rb
UTF-8
3,122
2.84375
3
[]
no_license
require 'sinatra' require 'slim' get '/?' do redirect "http://localhost:4567/home" end get '/home/?' do $blog_posts ||= [] slim <<-VIEW doctype html html head title My Blog - home body h1 Blog Listings form action='/create' method='GET' butto...
true
ed4db8bc92eb5f5a4dfbac958e390a07455fd5ea
Ruby
guillaume-gomez/ruby-sandbox
/fib.rb
UTF-8
341
3.59375
4
[]
no_license
def fib(n) return 1 if n <= 1 u_zero = 0 u_one = 1 u_n = 1 index = 2 while index < n old_un = u_n u_zero = u_one u_one = old_un u_n = u_zero + u_one index += 1 end u_n end puts "fib(1) = #{fib(1)}" puts "fib(2) = #{fib(2)}" puts "fib(3) = #{fib(3)}" puts "fib(4) = #{fib(4)}" puts...
true
0d60655916ae4a76609ebd923da0119bb7bfd7fe
Ruby
dougtebay/project-euler-even-fibonacci-e-000
/lib/even_fibonacci.rb
UTF-8
209
3.1875
3
[]
no_license
# Implement your procedural solution here! def even_fibonacci_sum(num) prev = 0 fib = 1 sum = 0 while fib < num sum += fib if fib % 2 == 0 fib = fib + prev prev = fib - prev end sum end
true
0e0987b7294a75e73a9fc74f73edff607feaa6a1
Ruby
mathie/wine_db
/lib/importers/lwin/row.rb
UTF-8
1,917
2.875
3
[]
no_license
module Importers module Lwin class Row INVALID_CELLS = [ 'NA', '-' ] def initialize(row) @row = row end def inspect attributes = [ :identifier, :status, :producer, :wine, :country, :region, :subregion, :colour, :type, :designation, :classific...
true
5a97a3d865edf5d8c4f27a4318b58ee3a2e5b1f6
Ruby
claremacadie/ls_rb100
/ch5_loops_iterations/recursion.rb
UTF-8
154
3.859375
4
[]
no_license
# recursion.rb puts "Type a number greater than 1" x = gets.chomp.to_i def countdown(x) puts x if x > 0 countdown(x - 1) end end countdown(x)
true
4c43a997e16d71543d7e380f41d75f4e8047c2c0
Ruby
elvispeter91/wdi-october-2017
/31-how-to-test/seatyourself/app/models/restaurant.rb
UTF-8
328
2.53125
3
[]
no_license
class Restaurant < ActiveRecord::Base validates :name, :opening_hour, :closing_hour, presence: true belongs_to :category has_many :reservations def available?(datetime, party_size) space_left = self.capacity - self.reservations.where(begin_time: datetime).sum(:party_size) space_left >= party_size ...
true
336b0cea663629097e70e923225b1feb0da180d2
Ruby
dukex/statikaj
/lib/statikaj/render.rb
UTF-8
1,164
2.59375
3
[ "MIT" ]
permissive
require 'erb' require 'builder' require 'statikaj/version' module Statikaj class Render attr_accessor :title, :articles, :description, :url, :category def initialize(source, options) @source = source @article = options.delete(:article) if options[:article] @articles = options.delete(:articl...
true
8652c6bf682c91895cc662cda5fa4229ef27fbf9
Ruby
morgvanny/reverse-each-word-001-prework-web
/reverse_each_word.rb
UTF-8
158
3.5625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(sentence) array = sentence.split(" ") reversed_array = array.collect do |word| word.reverse end reversed_array.join(" ") end
true
f9eaafaa50a1de298d3a56b13964cbfe8dbfeeb1
Ruby
matti/vh-s10
/project/svn-robotti/robot/common.rb
UTF-8
5,594
2.5625
3
[]
no_license
require 'find' require 'fileutils' REPO_DIR = ARGV[0] WORKING_DIR = REPO_DIR + '/tmp' $stdout = STDERR # svn hooks do not print stdout $last_errors = [] def debug(text) #puts "[DEBUG] " + text.to_s end def print_status() step = get_current_step.to_s puts '#################################################' pu...
true
e134204ec55b74734761ce4977a511e048baaf8f
Ruby
IrakliJani/codewars
/8-kyu/multiply.rb
UTF-8
98
2.8125
3
[ "MIT" ]
permissive
# http://www.codewars.com/kata/50654ddff44f800200000004/train/ruby def multiply a, b a * b end
true
31b8f4efbdc0e8b68173614d550f8814da8df448
Ruby
emonti/jruby_jrmi_toys
/rmiquery.rb
UTF-8
1,386
2.765625
3
[]
no_license
#!/usr/bin/env jruby # emonti@matasano.com - 2008 # # This script will attempt to enumerate RMI interfaces and their exposed # methods using JRuby. # # The script takes one argument, which is the URL for a remote RMI registry. # Example: # # rmiquery.rb //127.0.0.1:1099 # # Method names and prototypes are only availab...
true
7bd8f9ad5dc0731ef329741a7c486d993eeb45e0
Ruby
shamste82/ruby-collaborating-objects-lab-cb-000
/lib/mp3_importer.rb
UTF-8
372
2.90625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class MP3Importer attr_accessor :path, :files, :song, :artist def initialize(path) @path = path end def files @files = Dir[@path + "/*.mp3"] file_no_path = @files.map { |file| File.basename(file) } @files = file_no_path @files end def import files = self.files songs = files.ma...
true
aa6f7a1f5b391535be5b0d2348ee65006fa1f9cf
Ruby
flozzone/gollum-lib
/lib/gollum-lib/macro/navigation.rb
UTF-8
2,093
3.140625
3
[ "MIT" ]
permissive
module Gollum class Macro # Displays a tree of all available pages with links to them. # # Directories link to their underlying Home page. # e.g. Directory/ -> Directory/Home class Navigation < Gollum::Macro # Recursively insert page into tree according node_list # # tree ...
true
1bd1cbcf7780ada868b036ae16caf1973e883436
Ruby
vsav/thinknetica
/Metaprogramming/accessors.rb
UTF-8
1,030
2.875
3
[]
no_license
module Accessors def self.included(base) base.extend ClassMethods end module ClassMethods attr_accessor :history def attr_accessor_with_history(*methods) methods.each do |method| define_method(method) do instance_variable_get("@#{method}") end define_method("...
true
70d8744165c0105b7437886b1ef22fadb2f2c73c
Ruby
dipto0321/datastructures-and-algorithm
/ruby/Exercism/isogram/isogram.rb
UTF-8
98
2.796875
3
[]
no_license
module Isogram def self.isogram?(input) /(\w).*\1/.match(input.downcase).nil? end end
true
cf24f7473f0cf2adb5536a53c75fc6fecdee1fa9
Ruby
lanajen/hackster
/lib/heroku_domains.rb
UTF-8
928
2.640625
3
[]
no_license
require 'heroku-api' module HerokuDomains module Manager class << self @@heroku = Heroku::API.new(api_key: ENV['HEROKU_API_KEY'], mock: Rails.env == 'development') def add_domain(domain) begin @@heroku.post_domain(ENV['HEROKU_APP'], domain) rescue => e Rai...
true
51341a82d84027ee4690db69c054648af7a752e7
Ruby
wayneeseguin/sequel-model
/spec/relations_spec.rb
UTF-8
3,456
2.59375
3
[ "MIT" ]
permissive
require File.join(File.dirname(__FILE__), "spec_helper") describe Sequel::Model, "one_to_one" do before(:each) do MODEL_DB.reset @c1 = Class.new(Sequel::Model(:attributes)) do end @c2 = Class.new(Sequel::Model(:nodes)) do end @dataset = @c2.dataset $sqls = [] @dataset.extend(Modu...
true
24f07241c7954873e67453fcb7a4562a52623315
Ruby
gitter-badger/platform_lib_ruby
/lib/platform_lib/media_service.rb
UTF-8
1,761
2.953125
3
[ "MIT" ]
permissive
require 'uri' require 'json' require 'platform_lib/service_base' module PlatformLib # Public: A wrapper around the Media Data Service # # Examples: # # # the preferred method # service = PlatformLib::DataService.new("user", "pass").media_service # # # direct instantiation # service =...
true
c4f4d8ecb4999b2fc9e7569e6654e6970f02d66e
Ruby
seansu4you87/skiena
/ruby/spec/lego/priority_queue_spec.rb
UTF-8
803
2.8125
3
[ "MIT" ]
permissive
require 'spec_helper' describe Lego::PriorityQueue do let(:pq) { Lego::PriorityQueue.new } describe "#push" do it "pushes" do pq.push 4, "Sean" pq.push 5, "Yu" pq.push 2, "Hello" expect(pq.to_s).to eql '(2, Hello), (5, Yu), (4, Sean)' end end describe "#pop" do it "pops t...
true
2791961bb940bd67e619ffa24470d35dbebe9e16
Ruby
hibernatingnerd/ruby_fundamentals1
/exercise2.rb
UTF-8
617
4.09375
4
[]
no_license
#calculate the tip for a meal meal_value = 55 tip = meal_value * 0.15 puts "#{tip} is a good tip to leave." # add a integer to a string by coverting the # integer using to a string using .to_s my_name = 'jeffery' my_name += 2000.to_s puts my_name # in sentnce string interpolation puts "45628 multiplied by 7839 equals...
true
368042b577344d04d87a6d97160849460c12bd44
Ruby
gleaks/fti
/bin/app/controllers/materials_controller.rb
UTF-8
2,590
2.78125
3
[]
no_license
class MaterialsController < ApplicationController def index # Fetch every order from the database orders = Order.all.order(date: :desc) # Fetch all active assemblies @headers = Assembly.where(active: true).order(order: :asc) # Start an empty array of all of the ...
true
bf844ca96df68b1db9bc06345efe23397a91886b
Ruby
jakubgarfield/battleships
/app/models/ship.rb
UTF-8
1,631
3.140625
3
[]
no_license
class Ship < ActiveRecord::Base belongs_to :player validates :start_coordinate_x, :start_coordinate_y, :end_coordinate_x, :end_coordinate_y, :presence => true validates :start_coordinate_x, :start_coordinate_y, :end_coordinate_x, :end_coordinate_y, :numericality => { :only_integer => true, :greater_...
true
9b177b7651c5cb421a957f7dbb6c2bbee7c3baa5
Ruby
bugsnag/bugsnag-ruby
/spec/support/exception_with_detailed_message_ruby_1.rb
UTF-8
344
3.015625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# ExceptionWithDetailedMessage for Ruby 1.9 (no keyword argument) class ExceptionWithDetailedMessage < Exception def detailed_message(params) # change the output to ensure we pass the right value for "highlight" if params[:highlight] "\e[1m!!! #{self} !!!\e[0m" else "#{self} with some extra de...
true
de3205273e2d5d090f027403c4cfaccec050aaa3
Ruby
nats-io/nats.rb
/examples/auto_unsub.rb
UTF-8
707
2.921875
3
[ "Apache-2.0" ]
permissive
require 'rubygems' require 'nats/client' ["TERM", "INT"].each { |sig| trap(sig) { NATS.stop } } def usage puts "Usage: ruby auto_unsub.rb <subject> [wanted=5] [send=10]"; exit end subject = ARGV.shift wanted = ARGV.shift || 5 send = ARGV.shift || 10 usage unless subject NATS.on_error { |err| puts "Server Err...
true
f503b26191bb54ccb246f20c4b6a20ffe881f37c
Ruby
sonereker/grokking-algorithms
/ruby/ch7/dijkstra_s.rb
UTF-8
1,859
3.65625
4
[]
no_license
@processed = [] def cheapest(graph) p "Graph: #{graph}" costs = extract_costs(graph) parents = extract_parents(graph) lowest_cost_node = find_lowest_cost_node(costs) while lowest_cost_node cost = costs[lowest_cost_node] neighbours = graph[lowest_cost_node] neighbours.each do |node, neighbour_...
true
ea1d6aca7ffb87fa73fa508c38dc1487deb66ee4
Ruby
4rlm/dbc_onsite
/_0_skeletons/file_magic/file_magic/app/controllers/index.rb
UTF-8
2,142
2.59375
3
[]
no_license
get '/' do @entries = Entry.order('updated_at ASC').limit(10) ## query: joins, group, order, count, limit, count ## @tags = Tag.joins(:taggings).group("tags.name, tags.id").order("count(tags.name) desc").limit(10) erb :index end ############ Trial as Module ######## get '/file_magic' do erb :'file_magic' en...
true
fa9851096f3157a07d638f64859d7c9e748d8224
Ruby
PathaShiva/load_balancer
/load_balancer.rb
UTF-8
2,295
2.703125
3
[]
no_license
require "./database_monitor" class LoadBalancer include DatabaseMonitor DATABASE_MONITOR_INTERVAL = 10 POLICY_NAME = { 'dynamic_weight' => DynamicWeight } attr_reader :workers,:databases,:priority_queue,:current_requests,:policy def initialize() @databases = {} database_monitor @worker...
true
c4656b2903a376269a3a4062bbe86cace7894f58
Ruby
Peregrine42/grad_assessment
/spec/builder_unit_test.rb
UTF-8
1,301
3.15625
3
[]
no_license
require 'minitest/autorun' require './lib/chainlink' class TestBuilder < Minitest::Test Employee = Struct.new :id, :manager def test_find_start_of_lines input = ['nope', 'employee id', 'employee id | name', 'employee id | name | manager id'] assert_equal 4, Builder.new...
true
26042d99ee03ecb996d71d978d568f827f64aa97
Ruby
thehenster/two_queues
/lib/two_queues.rb
UTF-8
1,539
3.203125
3
[]
no_license
require 'thread' module TwoQueues class Scheduler attr_accessor :jobs # # options - :jobs - give it a pre-exisiting jobs queue # :results - give it a pre-exisiting results queue # :num_workers - the number of threads to start # def initialize(opts={}) ...
true
165b8f6aa0a41428802913cf9a8166f53b15a661
Ruby
jamesscalise/ruby-enumerables-introduction-to-map-and-reduce-lab-online-web-prework
/lib/my_code.rb
UTF-8
1,174
3.453125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def map_to_negativize(source_array) newArray = [] i=0 while i < source_array.length do newArray << (source_array[i] * -1) i = i+1 end return newArray end def map_to_no_change(source_array) return source_array end def map_to_double(source_array) i=0 newArray = [] while i < source_array....
true
b0ec954ead3dcccb69a70c527f06947bb0938562
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/food-chain/25e5d6d0f1b84654a6176665d9d489d9.rb
UTF-8
2,742
3.75
4
[]
no_license
require 'ostruct' class FoodChainSong FOOD_CHAIN = [ { type: "fly", rhyme: "I don't know why she swallowed the fly. Perhaps she'll die." }, { type: "spider", rhyme: "It wriggled and jiggled and tickled inside her.", alt_rhyme: " that wriggled and jiggled and tickled inside her" }, ...
true
2465bdb9614e139d9d2e93c37d1ae6b6e8a58ce7
Ruby
acushlakoncept/coding-challenges
/ruby/recursive/bottles.rb
UTF-8
203
3.6875
4
[]
no_license
# frozen_string_literal: true def bottles(n) if n.zero? puts 'no more bottles of beer on the wall' else puts "#{n} bottles of beer on the wall" bottles(n - 1) end end puts bottles(5)
true
8a637ed0a8db645a22934a75750a457aecb04eb9
Ruby
davissp14/messenger
/lib/messenger/client.rb
UTF-8
2,113
2.625
3
[]
no_license
module Messenger class Client class CommunicationDown < StandardError; end def self.start! puts "This is where communication will be logged..." begin redis = Redis.new(url: Messenger::REDIS_SERVER_URI) redis.subscribe_with_timeout(9999999, Messenger::CHANNELS) do |on| on...
true
d92f743eea0332fc4c9f14a1f854639f722134bc
Ruby
tinaylee/fh_homework_13
/lib/person.rb
UTF-8
423
3.421875
3
[ "MIT" ]
permissive
class Person attr_reader :first_name attr_reader :last_name def initialize (first_name, last_name) @first_name = first_name @last_name = last_name end def full_name _full_name end def full_name_reversed _full_name_reversed end private def _full_name return "#{first_name}...
true
793ac4da01a75149c53f9b80780e120850a27402
Ruby
roberthead/rtanque_bot
/bots/support/competitor_snapshot.rb
UTF-8
857
2.875
3
[]
no_license
class CompetitorSnapshot attr_reader :reflection, :tick_index, :position def initialize(tracking_bot, reflection, tick_index) @tick_index = tick_index @reflection = reflection @position = computed_position(tracking_bot) end def computed_position(tracking_bot) x = (tracking_bot.sensors.position...
true
cd8ceec9d8b363b96bc6413dd8d5b4302df9ea66
Ruby
clarehsu390/LeetCode
/Ruby/max_sub_arr.rb
UTF-8
886
3.578125
4
[]
no_license
#have two pointers def max_sum_array(nums) #O(n**2) max = nums[0] (0..nums.length - 1).each do |i| (i+1..nums.length - 1).each do |j| sum = nums[i..j].reduce(:+) max = sum if max < sum end end max end p max_sum_array([4,-1,2,1]) def max_sum_array2(nums) ...
true
d152dfd87526c0e54f4fe40acb45ffdac388e6bf
Ruby
lamontanaro/minesweeper_api
/app/services/board_service.rb
UTF-8
776
3.078125
3
[]
no_license
class BoardService BOARD_SIZE = 10 # square MINE = 'x' MINE_FLAG = '⚑' HIDDEN_CELL = '⬜' TOTAL_CELLS = BOARD_SIZE * BOARD_SIZE EMPTY_CELL = '•' EASY_LEVEL = BOARD_SIZE - 1 def initialize @visible_board = generate_clean_grid @mine_board = generate_grid_with_mines(@visible_board) end def ge...
true
65552057911aa70674fe2c02cd6e0a98addf975f
Ruby
peterjcole/boris-bikes-thursday
/spec/van_spec.rb
UTF-8
742
2.5625
3
[]
no_license
require 'van' describe 'van' do let(:van) { Van.new } let(:bike) { double(:bike, :working? => false) } let(:station) { double(:station, :release_broken => [bike]) } let(:garage) { double(:garage, :receive => :bike) } context 'listing contents' do it 'returns empty array when empty' do expect(van....
true
6b8e6d18fa8b49d748ad8ced5737731a4b6b86c6
Ruby
gouf/lita-weather
/lib/lita/handlers/weather.rb
UTF-8
1,205
2.75
3
[ "MIT" ]
permissive
require 'my_mechanize/client' require 'my_mechanize/weather' module Lita module Handlers class Weather < Handler # insert handler code here http.post '/weather', :weather_http route(/weather\s(.+)/i, :weather) def weather_http(request, response) area = request.env['rack.input'][:...
true
1605abaff4004acb3ff18701b49517956aebf36b
Ruby
pdcawley/announcements
/lib/announcements/subscription_registry.rb
UTF-8
3,615
2.640625
3
[ "LicenseRef-scancode-other-permissive", "Ruby", "MIT" ]
permissive
module Announcements class SubscriptionRegistry attr_accessor :classes_and_subscriptions, :subscription_class def initialize @classes_and_subscriptions = {} @subscription_class = ::Announcements::Subscription end def release @classes_and_subscriptions = {} end def crea...
true
105293ff8b307f52a1fec1e4560de778e977be34
Ruby
punerb/ideahub
/app/models/setting.rb
UTF-8
428
2.515625
3
[]
no_license
class Setting < ActiveRecord::Base attr_accessible :name, :value def self.method_missing(identifier, args = nil) identifier = identifier.to_s.gsub '=', '' set = Setting.where(name: identifier).first if args.nil? and !set.nil? return set.value elsif !args.nil? set ||= Setting.new(name:...
true
f121892bf2a33651d570a59948e33c9aeb849cc3
Ruby
keisuken/pureimage
/samples/alpha.rb
UTF-8
1,141
2.96875
3
[ "MIT" ]
permissive
# ruby -I../lib alpha.rb require 'pureimage' image = PureImage::Image.new(280, 170, 0xffffff, true) font = PureImage::Font.new('../fonts/sazanami-mincho-20.fnt') # ---- Draw frame ---- image.draw_rect(0, 0, 279, 169, 0x000000) # ---- Draw title ----- title = "alpha.rb" image.font = font image.draw_string(title, ...
true
efc0495a359baf52fbcce80c381d765a80640d13
Ruby
nutella-framework/nutella_lib.rb
/lib/nutella_lib/core.rb
UTF-8
2,785
2.921875
3
[ "MIT" ]
permissive
# This module is the wrapper around the whole nutella library. module Nutella # Initializes this component as a run component # @param [String] broker_hostname # @param [String] app_id # @param [String] run_id # @param [String] component_id def self.init( broker_hostname, app_id, run_id, component_id ) ...
true
1474eb34a26b5d45a403a567a127423aa554b6d8
Ruby
trambui09/betsy_enhancements
/test/models/merchant_test.rb
UTF-8
4,608
2.765625
3
[]
no_license
require "test_helper" describe Merchant do let (:new_merchant) { Merchant.new(provider: "github", uid: 111, email: "testing@gmail.com", username: "testingname") } it "can instantiated a new merchant with the right fields" do expect(new_merchant.valid?...
true
f35f1245c5487b00e5ceefdd7d791f821c110323
Ruby
volodymyr-mykhailyk/advent-of-code-2020
/tasks/day02/runner.rb
UTF-8
743
2.875
3
[]
no_license
require_relative '../utils/printer' require_relative '../utils/input_reader' require_relative '../../lib/security/password_checker' input_reader = Utils::InputReader.new(File.expand_path('input.txt')) input = input_reader.all_lines.split_with(': ').read info "Finding invalid passwords in input: #{input.length}" pass...
true
a626ab293de8d36410482ab67bf3e70e491fc2a1
Ruby
y1t2/ruby_games
/boardgame.rb
UTF-8
15,769
3.171875
3
[]
no_license
=begin <4人用ボードゲーム> 金貨を一番多く手に入れたプレイヤーが優勝(6ターンでゲーム終了) サイコロの出目が3つ表示され、1つを選択して進む [踏んだマスが自分の色と同じ]もしくは[宝マス]の場合、金貨が多くもらえる(1Pは赤、2Pは青、3Pは緑、4Pは黄) 選択肢4を選択すると、金貨を消費して特技が使える 敵マスにぶつかると戦いが始まり、勝利すると大金を入手し、全プレイヤーを初期位置に戻す 補足: ステージはランダム生成 敵ステータスは自分以外のプレイヤーの平均値 選ばなかった出目は自プレイヤーのステータス強化に使われる =end #ステージ設定 @warp_4 = Random.rand(3)+1 @posit...
true
fb324d9076e3986b0a92046e83f0b0e8ae31f8bc
Ruby
ratbeard/my-wedding-website
/scripts/scrape_registries.rb
UTF-8
2,871
2.859375
3
[]
no_license
require 'net/http' require 'rubygems' require 'hpricot' require 'uri' class Scrapper def run registries = [Target.new, Crate.new, Macys.new] output = Registry.csv_header registries.each do |registry| registry.run csv = registry.to_csv puts "==#{registry.class.name}==", csv ou...
true
bd9163503fc8c909e2dbe8276f32f87b88b09ccf
Ruby
winterlamon/advanced-hashes-hashketball-web-100817
/hashketball.rb
UTF-8
5,588
3.140625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def game_hash { :home => { :team_name => "Brooklyn Nets", :colors => ["Black", "White"], :players => { "Alan Anderson" => {:number => 0, :shoe => 16, :points => 22, :rebounds => 12, :assists => 12, :steals => 3, :blocks => 1, :slam_dunks => 1}, "Reggie Evans" => {:...
true
51eefa83061f6f0d42a06c45103beb47ec7f948b
Ruby
adsr303/from-node
/test/test_from_node.rb
UTF-8
5,099
2.703125
3
[]
no_license
require 'from_node' require 'rexml/document' require 'test/unit' class TestFromNode < Test::Unit::TestCase # Helper method def xml(s) REXML::Document.new(s) end class AttrWithoutXPath include FromNode xpath_attr :b end def test_attr_without_xpath doc = xml('<a b="123"/>') a = AttrWit...
true
66138e1862acba6a54a5d56e3e2d6129fed210c8
Ruby
alexander-mathieu/backend_prework
/day_2/iteration_each_names.rb
UTF-8
276
3.625
4
[]
no_license
names = ["Alice Smith", "Bob Evans", "Roy Rogers"] names.each do |full_name| puts full_name end p names.first p names.last p names.map { |name| name.gsub(/[^A-Z]/, '') } p "#{names.last} has #{names.last.length} characters... including the space." p names.join.delete(' ').length
true
875a6c9ebcd495249939128283d18b7a83cd3586
Ruby
Tinend/FantasyKarte
/lib/Typen/WuestenErsteller.rb
UTF-8
10,604
2.90625
3
[ "MIT" ]
permissive
require "berechneEntfernung" require "DuenenPunkt" require "HoehenProfil/WuestenHoehenPunkt" class WuestenErsteller GlaetteDistanz = 3 MaxHoehenFaktor1 = 0.3 MaxHoehenFaktor2 = 6 ZufallsHoehen = 0.02 MinHoehe = 0.0001 FreieFelderMaxHoehe = 5 DuenenWkeit = 0.3 HoehenZielZerfall = 0.8 HoehenZerfall = ...
true
3c7c8f883ed2b623df66db9feafb2daf77c51843
Ruby
ANUSF/ADA-CMS
/lib/mutexer.rb
UTF-8
722
3.375
3
[ "MIT" ]
permissive
class Mutexer LIMIT = 1 MUXES = [] LIMIT.times {MUXES << Mutex.new} def self.reset for mutex in MUXES mutex.unlock if mutex.locked? end end def self.wait_for_mutex(n) mutex = Mutexer.available begin mutex = Mutexer.available sleep n if mutex.nil? end while m...
true
2590eb975fd043fe3f3e163f10e51ce93ed51f5c
Ruby
VirgilCantu/find_a_cocktail
/lib/find_a_cocktail/api.rb
UTF-8
1,364
3.15625
3
[ "MIT" ]
permissive
class API def self.find_cocktails(cocktail) url = "https://www.thecocktaildb.com/api/json/v1/1/search.php?s=#{cocktail}" response = RestClient.get(url) if response.body == "{\"drinks\":null}" puts "" puts "Sorry, that drink is not in the database, please try agai...
true
177b4e3917093a1bf8ce5eeac3ec2dfe99a718fb
Ruby
kulturpessimist/pxlz
/pxlz.rb
UTF-8
1,640
2.734375
3
[]
no_license
#!/usr/bin/env ruby require 'rubygems' require 'chunky_png' require 'yaml' require 'erb' #if !ARGV[0] # puts "Usage: pxlz.rb path-to-image" # exit #end # constants per_row = per_column = per_side = 16 dimensions = { :width => 1000, :height => 800 } tmpl = ERB.new DATA.read image = ChunkyPNG::Image.from_file 't...
true
3fd17a27d9256d9ba435af7cf19a5e01bebdd22c
Ruby
des1991/thinknetica
/Lesson4/route.rb
UTF-8
287
3.578125
4
[]
no_license
class Route attr_reader :stations def initialize(from, to) @stations = [from, to] end def add_station(station) @stations.insert(-2, station) end def remove_station(station) @stations.delete(station) unless stations.values_at(0, -1).include?(station) end end
true
d71b796fe36702b24d37c7c9c69ce2cb9be956e0
Ruby
songjiayang/battleship_game
/ship.rb
UTF-8
109
2.625
3
[]
no_license
class Ship attr_writer :alive def initialize @alive = true end def alive? @alive end end
true
603cb3c86d80d911c81d9c244c071cf329f4dda9
Ruby
lbirts/Leetcode-Interview-Prep
/arrays/ruby/single_number.rb
UTF-8
254
3.171875
3
[]
no_license
def single_number(nums) #74% # hash = {} # nums.each do |x| # if hash[x] # hash[x]+=1 # else # hash[x] = 1 # end # end # return hash.key(1) #97% 2 * nums.uniq.sum - nums.sum end
true
ef174a5469121099eceeb8dbdc4426d1a7f81167
Ruby
dodoliu/leetcode_practice
/lib/ugly_number.rb
UTF-8
343
3.40625
3
[ "MIT" ]
permissive
# @param {Integer} num # @return {Boolean} def is_ugly(num) return false if num < 1 while num % 2 == 0 num /= 2 end while num % 3 == 0 num /= 3 end while num % 5 == 0 num /= 5 end return num == 1 ? true : false end p is_ugly(-20); #被 2 或 被 3 或 被5 无限整除的数,被称为 丑数
true
775272e44d7b629404e2cd8c7444b0585ebaf7e4
Ruby
16sheep/oop-practice
/app/models/location.rb
UTF-8
755
3
3
[]
no_license
class Location #has many trainers through TrainerLocation attr_accessor :name ALL = [] def initialize(name) @name = name ALL << self end def self.all ALL end def find_trainers_in_this_location TrainerLocation.all.select do |tl| tl.trainer = self ...
true
f0a2140a6ec1c8ea5452956ac5c2c71894a6862a
Ruby
mwagner19446/wdi_work
/w03/d05/Jessica/cipher/lib/cipher.rb
UTF-8
372
3.25
3
[]
no_license
class Cipher def self.encode(word) @alphabet = ("a".."z").to_a @cipher_alphabet = ["n","o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m"] i = 0 while i < word.length index_word = @alphabet.index(word[i]) value = @ciphe...
true
ffefad00ab29ce5bd8b7771e7baaef89a2127629
Ruby
WizardOfOgz/WizardOfOgz.github.io
/listings/double_splat/block_params.rb
UTF-8
470
2.84375
3
[]
no_license
require "erb" posts = [ { date: "2015-08-16", author: "Dave Jones", title: "Under the Sea", options: {} }, { date: "2015-08-15", title: "Message from Beyond", options: {} }, { date: "2015-08-12", author: "Jon Smith", title: "Expression of Love in Powhatan", options: {} } ] raw_erb = <<ERB <% posts.each do |titl...
true
d2cfc89291e1ace66a2ab34d8ecbc454a6b8155e
Ruby
konradrog/Ruby_Introduction
/Zadania_02_OOP/Library/book.rb
UTF-8
246
2.875
3
[]
no_license
class Book attr_accessor :title, :author, :pub_date, :borrowed, :book_id def initialize(title, author, pub_date, book_id) @title = title @author = author @pub_date = pub_date @book_id = book_id @borrowed = false end end
true
3e493a6f0ea6a91301f2b7e6d820e9a2b3cb1497
Ruby
paulghaddad/think_like_a_programmer_problems
/arrays/finding_the_mode.rb
UTF-8
937
3.78125
4
[]
no_license
=begin In statistics, the mode of a set of values is the value that appears most often. Write code that processes an array of survey data, whether survey takers have responded to a question with a number in the range 1-10, to determine the mode of the data set. For our purpose, if multiple modes exist, any may...
true
ca4a479a57f9430567215c10b763698aa96081d3
Ruby
ronan-mch/seek
/spec/processors/simple_tokenizer_spec.rb
UTF-8
765
2.859375
3
[ "MIT" ]
permissive
require 'spec_helper' describe Processors::SimpleTokenizer do it 'should split text by spaces' do input = 'the wonderful thing' expect(described_class.call(input)).to include 'the' expect(described_class.call(input)).to include 'wonderful' expect(described_class.call(input)).to include 'thing' end ...
true
2ecde64b4e78551dd5ec582ea7eaeb5da76c6210
Ruby
rmoneypenny/gamenight
/app/models/game.rb
UTF-8
494
2.625
3
[]
no_license
class Game < ApplicationRecord belongs_to :room validates :name, presence: true validates :weight, presence: true validates :room_id, presence: true def submit(names, vote, weight, room_id) names.each do |n| vote ||= false game = Game.new(:name => n.chomp, :vote => vote, :weight => weight, :room_id => ...
true
c45c2adea67266fcf0e8e2660851bc9466c2c7af
Ruby
MayaCoro/learn-co-sandbox
/sweetjamz.rb
UTF-8
360
2.8125
3
[]
no_license
class Album @@album_counter = 0 @@album_counter += 1 def release_date=(date) @release_date = date end def release_date @release_date end end kod = Album.new kod.release_date = "April 2018" ye = Album.new ye.release_date = "June 2018" shawn_mendes = Album.new shawn_mendes.release_d...
true
3eac8ef6e19830d4a3892a0d4239678f08368efa
Ruby
BenjaminCoccoli/rails-yelp-mvp
/db/seeds.rb
UTF-8
921
2.5625
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 rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
true
449a5c863144769ca39a870e93216e3653c58e8d
Ruby
mcshakes/game_of_life_ruby
/spec/cell_spec.rb
UTF-8
529
2.71875
3
[]
no_license
require "rspec" require "pry" require "./app/world" require "./app/cell" describe "Cell" do subject { Cell.new } let(:world) { World.new } describe "when initialized" do it "has a location attributes" do expect(subject).to respond_to(:x) expect(subject).to respond_to(:y) end it "is dead...
true
11098eee5304f6379f7053d605a6b7d0d4f2a02b
Ruby
MaddTheSane/Camino
/tools/os-symbol-generation/dependency_list_generator
UTF-8
5,579
2.59375
3
[]
no_license
#!/usr/bin/ruby # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. require 'open3' def main() if ARGV.length < 1 print_usage() exit(1) end seed_apps = ARGV...
true
eaecef3349b85bd488c4471e77acde244321fa4c
Ruby
adcpe/c2-module2
/week-1/day-2/compound-interest.rb
UTF-8
362
3.765625
4
[]
no_license
puts 'Enter the amount of months: ' months = gets.chomp.to_i puts 'Enter the amount of money: ' money = gets.chomp.to_f puts 'Enter the interest rate: ' interest = gets.chomp.to_f def interest(months, money, interest) i = 1 while i <= months money += (money * interest / 100) i += 1 end money.round(2)...
true
bd32046439f9992acbb23812f003a4824f7ff3fd
Ruby
MaksymPylypenko/Math-expression-solver
/expression.rb
UTF-8
3,444
3.765625
4
[]
no_license
require "./binary" #------------------------------------------------ #ExpressionTree #------------------------------------------------ class ExpressionTree < BinaryTree #constructor def initialize(line) @root = recursive(line, 0) end #inorder tree traversal def printInorder(root) traverseInorder(r...
true
4c35bcec20b90cf0cc05fc9acef34bfa0a228700
Ruby
erikolsson/euler-solutions
/code/problem107_new.rb
UTF-8
954
2.984375
3
[]
no_license
nodes = File.read("./network.txt").split("\n").map{|val| val.split(",").map{|val| val.to_i}} class Edge attr_accessor :from attr_accessor :to attr_accessor :weight def initialize(from, to, weight) @from = from @to = to @weight = weight end end edges = Array.new for x in 0...nodes.length for y in 0...nod...
true
d5dc0e80075126776d7ea2a6e606e4f58a995129
Ruby
merongivian/semetric
/lib/semetric/artist/data.rb
UTF-8
939
2.53125
3
[]
no_license
module Semetric module Artist class Data def initialize(name) @name = name end def bio entity_request.overview end def images entity_request.images end %w(fans plays views comments downloads).each do |statistic_field| define_method stati...
true
ee56a7344a914a71f67764bf4df0aac6b11c0a14
Ruby
jorjahung/somatra
/app/controllers/moods_controller.rb
UTF-8
1,265
2.875
3
[]
no_license
class MoodsController < ApplicationController def index @mood = Mood.new @moods = Mood.order('created_at DESC').all end def create @mood = Mood.create(mood_params) if @mood.save analyze_sentiment @mood = Mood.new @moods = Mood.order('created_at DESC').all render "moods/index"...
true
1a755bc576f4b864c63fe19b9e4b0570f98cb6d9
Ruby
celestialheathen/ruby-project
/classes_3/singleton_methods.rb
UTF-8
257
3.546875
4
[]
no_license
class Player def play_game rand(1..2) == 1 ? "You won!" : "You lost!" end end james = Player.new bob = Player.new def james.play_game "YOU WON!!!!" end p james.play_game p bob.play_game p james.singleton_methods p james.singleton_class
true
da399663ca12711b1e8134c3f47c35626ae2bb06
Ruby
pedrohenriquerls/luz
/spec/model/coupon_spec.rb
UTF-8
1,749
2.734375
3
[]
no_license
require_relative '../../model/coupon' require 'spec_helper' describe Coupon do describe '.save' do it 'should return nil' do expect(Coupon.find(0)).to be nil end it 'should return id 0' do coupon = Coupon.new(0, 2.5, 'test', '2016/07/01', 1) coupon.save coupon = Coupon.new(1, 3....
true
6ea90ed6e3b7b7ac140d46b9e690c44616ec192e
Ruby
rymanstevenson/RubyTheHardWay
/ex17.rb
UTF-8
685
2.953125
3
[]
no_license
#any lines of code commented out in this file that could be instead #deleted are left in for acedemic purpose. from_file, to_file = ARGV puts "Copying from #{from_file} to #{to_file}" #do this on one line... indata = open(from_file).read #indata = in_file.read puts "The Input file is #{indata.length} bytes long" p...
true
682d72f73b2dd9bf108ad843880a24a0665be245
Ruby
vahaplar/CS342-Introduction-to-Desing-Patterns
/Project 2 - Gladiator Game/arenas/PathOfFire.rb
UTF-8
10,041
3.65625
4
[]
no_license
require 'timeout' require_relative 'Arena' # Arena subclass class PathOfFire < Arena # Initializing with the gladiator def initialize(gladiator) @gladiator = gladiator # Important story items @artifact_key = 0 @artifact_rune = 0 # Retry chances of user @retries = 2 puts "Welcome to Path...
true
0c50b96488bf7f1ab8395ad6d7b7f9ad76b19673
Ruby
myk245/ruby-oo-class-variables-class-constants-nyc-web-010620
/lib/shoe.rb
UTF-8
543
3.65625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Shoe attr_accessor :color, :size, :material, :condition attr_reader :brand BRANDS = [] # Think about it! When does the BRANDS constant need to be # made aware of the brands of the shoes that are being created? => upon initialization # With assistance from https://repl.it/@seanoughton/OO-Basics-with...
true
d2b5d5aac8840ff4195bfa4612e122613e2ab22b
Ruby
shawnFiske/sea-c41-ruby
/lib/class2/exercise1.rb
UTF-8
310
3.828125
4
[ "MIT" ]
permissive
# 5 points # # Assuming leap-years don't exist, display the hours in a year. # # TIP: I expect you to use a mathematical equation. number_days = 365 number_hours_day = 24 number_hours_year = number_days * number_hours_day # puts "Number of hours in a year: " + number_hours_year.to_s puts number_hours_year
true
08ea3634a5d3db93c74e8b437d69b005ef78044f
Ruby
aduyko/advent_2020
/13b.rb
UTF-8
780
3.4375
3
[]
no_license
# I kept getting confused about the prompt for this one, and got confused looking for a more math-y solution calculating phases. I resorted to peeking online to figure it out. # At what timestamp will all the buses be lined up such that they leave idx minutes after each other? input_file = "inputs/13.txt" buses = [] F...
true
a6482ed07921163c5f7ec2bd984f7d9831ab65cd
Ruby
chrislsavage/RubyCoderbyteEasy
/LetterChanges.rb
UTF-8
502
3.09375
3
[]
no_license
alphabet = "abcdefghijklmnopqrstuvwxyz" vowels = "aeiou" newstr = "" def LetterChanges(str) i = 0 while i < str.length case str[i] when str[i] == "z" newstr+="a" when str.index(str[i]) == nil newstr+= letter when vowels.index(str[i]) != nil newstr+= str[i] else newstr += al...
true
4933f09c48af8cad6797069749a7aeeb70e89291
Ruby
xijo/adventofcode-2019
/day01/part1.rb
UTF-8
91
2.671875
3
[]
no_license
lines = File.readlines('day01/input') puts lines.map { |l| (l.to_i / 3.0).floor - 2 }.sum
true
637432614ebb2ded94871d8cab3b9486e96f7e65
Ruby
sergioschuler/mixpanel-blender
/tools/csv_writer.rb
UTF-8
2,942
2.578125
3
[]
no_license
require 'csv' require 'fileutils' require 'pry' def generate_csv_name (raw_event_array) puts "Generating CSV name" event_name = raw_event_array.first["event"] from_date = Time.at(raw_event_array.first["properties"]["time"]).strftime("%Y-%m-%d") to_date = Time.at(raw_event_array.last["properties"]["time"])....
true
df087a95c347eb32a27d3f3b1aac850474daa3ac
Ruby
TheRoyalTnetennba/coding_challenges
/hacker_rank/algorithms/warmups/diagonal_difference.rb
UTF-8
337
2.8125
3
[]
no_license
n = gets.strip.to_i a = Array.new(n) for a_i in (0..n-1) a_t = gets.strip a[a_i] = a_t.split(' ').map(&:to_i) end primary = 0 secondary = 0 a.each_index do |i| a[i].each_index do |j| next unless i == j primary += a[i][j] secondary += a[i][(a.size - 1) - i] end end print (primary ...
true
92471d4ea7c193523298d198cda29114720561ab
Ruby
SamanthaZhou/Practice-Problems
/lib/14_array_extensions.rb
UTF-8
284
3.390625
3
[]
no_license
class Array def sum total = 0 self.each{|x| total += x} total end def square squares = [] self.size < 1 ? self : self.each{|x| squares << x*x} squares end def square! self.size < 1 ? self : self.each_with_index{|x,idx| self[idx] = x*x} end end
true
a7bd8de6b3c1fd73b71c103859c4cde93ac66403
Ruby
tom021982/chef
/cookbooks/multiplefiles/recipes/default.rb
UTF-8
235
2.53125
3
[]
no_license
# this is a multiple files creation cookbook array = ['a', 'b', 'c'] array.each do |obj| file "/root/#{obj}" do action :create end end # %w(one two three).each for i in 1..10 do file "/root/#{i}" do action :create end end
true
e7bbc4138f2d3cdd1c9fba97ac19eb2ff77f292e
Ruby
Joeventures/tiy-stuff
/week02/tues/smart.rb
UTF-8
1,037
2.90625
3
[]
no_license
class SmartPlayer def get_guess(last_result = 'colder', last_guesses = [0,100] ) #last_guesses = [most recent, next most recent] #binding.pry if last_guesses[0] > last_guesses[1] && last_result == 'warmer' mid = (last_guesses[0] - last_guesses[1]) / 2 guess = last_guesses[0] + mid elsif last_guesses[0] >...
true
f6025ffbab1245399393a697a444176f9bfb1a98
Ruby
zeevex/health_monitor
/lib/health_monitor/health_monitoring.rb
UTF-8
11,945
2.75
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# = Health Monitor # Monitor individual aspects of your rails application's health # # Most rails applications have many additional moving parts of which the health cannot be assessed with # simply pinging the (hopefully page cached) homepage # # For example, # * Is Email is sent successfully? # * Is the SMS gatewa...
true
d347ec0c094e1f7575fb380224020aa1d2f6af64
Ruby
hgodinot/hgodinot-Launch_School
/code_wars/Ruby/2_kyu/ongoing/1.rb
UTF-8
1,807
3.59375
4
[]
no_license
# https://www.codewars.com/kata/52a78825cdfc2cfc87000005/train/ruby def calc expression # evaluate `expression` and return result end # tous nombres sont des float # When no operator between digit and bracket, treat it as a multiply : # 2(1+1) == 2*2 = 4 # Peut y avoir juste nombre: -123 #Challenges: # identif...
true
f0c5b046b308c7c8644ba4a78e4af2fa9b81a379
Ruby
pcahalane/intro_to_ruby
/arrays/ex6.rb
UTF-8
259
3.6875
4
[]
no_license
names = ['bob', 'joe', 'susan', 'margaret'] names[3] = 'jody' puts names # The original code is attempting to overwrite the 'margaret' value by calling the string itself but must instead # use the integer of the index as reflected in the adjusted code above.
true
aaa17684fa4cc33fa41bce5d6c1d6f86c9264e8a
Ruby
theKolbus/minesweeper
/minesweeper.rb
UTF-8
849
3.703125
4
[]
no_license
require_relative 'board' class Game def initialize @board = Board.new end def get_guess puts "Please enter a square to sweep ie 4,2".yellow guess = gets.chomp until guess.match?(/^(?:[Ff][, ])?\d+[, ]+\d+$/) puts "Not a valid space" get_guess ...
true
d4345cc36c0664b1ae600498ce356f751aa87922
Ruby
mattwynne/raffle
/spec/raffle/extent_spec.rb
UTF-8
845
2.828125
3
[]
no_license
require 'string_helper' require 'raffle/extent' module Raffle describe Extent do it "parses a string representation" do extent = Extent.parse '1,2-3,4' extent.start.line.should == 1 extent.start.column.should == 2 extent.finish.line.should == 3 extent.finish.column.should == 4 e...
true
15cfa5c4f391e5588e54798b2083e6c3d7553ff1
Ruby
mikebarile/rbnd-udacitask-part2
/lib/event.rb
UTF-8
520
2.890625
3
[]
no_license
class EventItem include Listable attr_reader :description, :start_date, :end_date def initialize(description, options={}) @description = description @start_date = Chronic.parse(options[:start_date]) if options[:start_date] @end_date = Chronic.parse(options[:end_date]) if options[:end_date] end ...
true