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
1318a5b0d7b47008813900c4999d4bf156d6da96
Ruby
jshorty/aa-projects
/poker/spec/hand_spec.rb
UTF-8
5,810
3.421875
3
[]
no_license
require 'hand' require 'card' describe Hand do subject(:hand) { Hand.new } let(:ace_s) { Card.new(:ace, :spades) } let(:king_s) { Card.new(:king, :spades) } let(:queen_s) { Card.new(:queen, :spades) } let(:jack_s) { Card.new(:jack, :spades) } let(:jack_h) { Card.new(:jack, :hearts) } let(:ten_s) { Card.n...
true
5948c9ae5b48cae51c194d99ad3a4eaabe563f22
Ruby
avis-hermetis/Rails
/tutu/app/models/train.rb
UTF-8
887
2.6875
3
[]
no_license
class Train < ActiveRecord::Base validates :number, presence: true belongs_to :current_route, class_name: 'Route', foreign_key: :current_route_id has_many :tickets has_many :wagons attr_accessor :e_up_places, :e_low_places, :c_up_places, :c_low_places def e_wagon_amt econom_count = 0 @e_up_pla...
true
04aea283e9b0cc02b68702b2c5dd7c805a87ba4f
Ruby
manishgkasera/coding_problems
/lib/eval_expr.rb
UTF-8
1,605
3.546875
4
[]
no_license
class EvalExpr def self.evaluate(expr) return if expr == '' || expr.nil? stack = [] expr.to_s.each_char do |c| case c when ' ', "\t" next when '(', '+', '-', '*', '/', c.to_i.to_s stack.push c when ')' v2 = pop_from_stack(stack) op = pop_from_stack(s...
true
cd84a64b9d10ebd3582cab0ccec29e0814a10a21
Ruby
haleymnatz/location-geocoder
/app/controllers/locations_controller.rb
UTF-8
1,197
2.578125
3
[]
no_license
class LocationsController < ApplicationController def index @locations = Location.all @location = Location.new end def create # Use httparty class to make api call to geocoding api api_response = api_call puts "called controller" if api_response["results"].empty? flash[:notice] = "...
true
04b87961b813d2b8671622be65b71fb1c375edf3
Ruby
travis-ci/travis-cookbooks
/run-cookstyle
UTF-8
1,676
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # vim:fileencoding=utf-8 require 'English' def main(argv = ARGV) return 1 if argv.empty? failed = [] cookbook_path = argv.first cs_args = %W(#{ENV['CS_ARGS']}) cs_tags = ENV['CS_TAGS'] || File.join(cookbook_path, '.cookstyle-tags') quiet = ENV['QUIET'].nil? ? false : true cookstyle...
true
f051a3aa6ac34dc3ed5c68c02e2af0d445817060
Ruby
scottfwlr/ribs
/lib/guts/inflector.rb
UTF-8
901
2.75
3
[]
no_license
class Inflect def self.new self end def self.table(string) self.plural(self.underscore(string)) end def self.plural(string) string + "s" end def self.singular(string) string[/s$/] ? string[0..-2] : string end def self.camelcase(string) string.split('_').map(&:capitalize).join(...
true
918c5e74d3cf60123cd0e30ea5c52a180f527af7
Ruby
hilohiro/sample-lottery
/lottery.rb
UTF-8
917
3.578125
4
[]
no_license
# -*- encoding: utf-8 -*- class Lottery def initialize(max_winners) throw ArgumentError.new(max_winners) unless 0 < max_winners @max_winners = max_winners @members = [] @weights = [] end def add(member, weight) throw ArgumentError.new('member should have value.') if member.nil? ...
true
7593ef726f1033cdb97a005877afd802d75db32a
Ruby
sanmingzi/study_algorithm
/algorithm/dynamic_programming/leetcode_0085/leetcode_0085.rb
UTF-8
748
3.203125
3
[]
no_license
# @param {Character[][]} matrix # @return {Integer} def maximal_rectangle(matrix) return 0 if (nil == matrix || matrix.empty?) row, column = matrix.length, matrix.first.length lengths = [] for i in 0..(row - 1) lengths[i] = [] lengths[i][0] = matrix[i][0].to_i for j in 1..(column - 1) ...
true
f1883c189ed99935b233b898ed3df480dc932ade
Ruby
jeffreyzhen/news-aggregator-postgresql
/app/models/article.rb
UTF-8
924
2.78125
3
[]
no_license
def db_connection begin connection = PG.connect(Sinatra::Application.db_config) yield(connection) ensure connection.close end end class Article def initialize (data = {}) @data = data end def title @data['title'] end def url @data['url'] end def description @data['des...
true
9efdf9518764a376f846b00672eeb72d6efdbdf0
Ruby
diegobarna/blog-sinatra
/lib/Post.rb
UTF-8
256
2.984375
3
[]
no_license
class Post attr_reader :title, :content, :author, :category, :date def initialize(title, content, author, category, date) @title = title @content = content @author = author @category = category @date = date.strftime("%F") end end
true
7f8da2c87600af936dd9bb71bf5f025e1ad4232e
Ruby
gerard76/magic_engine
/config/initializers/string.rb
UTF-8
151
2.8125
3
[]
no_license
class String def numeric? # `!!` converts parsed number to `true` !!Kernel.Float(self) rescue TypeError, ArgumentError false end end
true
dc19a3a09bd823533eb54da7f644759181dc6b76
Ruby
Laucsonium/scrapper2
/mairie.rb
UTF-8
731
2.796875
3
[]
no_license
require 'rubygems' require 'nokogiri' require 'open-uri' def get_the_email_of_a_townhal_from_its_webpage (city_link) base_page_url="http://annuaire-des-mairies.com" page=Nokogiri::HTML(open("#{base_page_url}#{city_link}")) mail=page.xpath('//table/tr[3]/td/table/tr[1]/td[1]/table[4]/tr[2]/td/table/tr[4]/td[2]/p/fo...
true
19d31e6b796a90e6807163e56ed3631a7a13233a
Ruby
katrinalui/tic-tac-toe
/lib/game.rb
UTF-8
1,231
3.796875
4
[]
no_license
require_relative 'board' require_relative 'human_player' require_relative 'computer_player' class Game attr_reader :board attr_reader :player_one attr_reader :player_two attr_reader :current_player def initialize(player_one, player_two) @board = Board.new @player_one = player_one @player_two = p...
true
f3fd8dc7609f188286f74d84741ea542e34d55ed
Ruby
geekerzp/ruby-study
/core/ruby解释器.rb
UTF-8
14,962
2.703125
3
[]
no_license
# # ==================== # | 执行Ruby解释器 | # ==================== # # ruby [options] [--] program [arguments] # # 常用选项 # ~~~~~~~~ # -w: 遇到废弃或问题代码时给出警告,同时设置$VERBOSE为true。 # -e script: 运行单行程序。 # -I path: 把path中的目录加到全局$LOAD_PATH数组的起始处,load和require方法会在 # 该数组包含的目录中搜索加载文件。 # -r libaray: 在程序运行前加载给定的lib...
true
e1688c3156acf2f2b90f8ec9f8f4d33f235a5aa2
Ruby
DeliSauce/W2D3
/TDD/spec/methods_spec.rb
UTF-8
1,937
3.921875
4
[]
no_license
require 'methods' describe "Array methods" do describe "#my_uniq" do context "It creates an array with unique values" do subject(:random_array) {[5,1,5,6,8,9,0,1]} let(:uniq_array) { [5,1,6,8,9,0] } it "raises an exeption when the argument is a string" do expect { my_uniq("string") ...
true
09a1ff8e72cb94dfe54975ad276fbd3171506421
Ruby
mboros1/LaunchSchool
/Exercises/RB_SmallProblems/Medium_1/ThousandLights.rb
UTF-8
280
3.265625
3
[]
no_license
def bank_switch(n) arr = Array::new(n,false) (1..n).each do |i| (i..n).step(i) do |idx| arr[idx-1]= !arr[idx-1] end end result = [] (0..n-1).each do |x| if arr[x] result << x+1 end end result end p bank_switch(5) p bank_switch(10)
true
3619e7395d767fbe73957717620cbb658f46a975
Ruby
arturoherrero/powercore
/spec/lib/powercore/integer_spec.rb
UTF-8
987
3.078125
3
[ "MIT" ]
permissive
RSpec.describe Integer do describe "#clamp" do it "clamps a comparable between a lower and upper bound" do expect(1.clamp(3, 6)).to eq(3) expect(5.clamp(3, 6)).to eq(5) expect(8.clamp(3, 6)).to eq(6) end it "clamps a comparable between a lower and upper bound of a Range" do expect...
true
76a1cb22964366e7f8f710eb096d51205931b71b
Ruby
andrewsapa/ruby_basics
/strings/ignoring_case.rb
UTF-8
523
4.15625
4
[]
no_license
#Using the following code, compare the value of name with the string 'RoGeR' while #ignoring the case of both strings. Print true if the values are the same; print #false if they aren't. Then, perform the same case-insensitive comparison, except #compare the value of name with the string 'DAVE' instead of 'RoGeR'. ...
true
1b6b76e3eb23e7e03058ea62ba66132eece19a1f
Ruby
jefflunt/fedexday
/features/step_definitions/web_steps.rb
UTF-8
1,427
2.53125
3
[]
no_license
require 'uri' require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) Given /^pending$/ do # Essentially allows marking an entire scenario as "pending", as opposed to just a single step # Useful when you have multiple tests failing, and you want to filter out a few, but still see # ...
true
6e2280301c057681222e85ab6018ae2fe0fb2250
Ruby
Sabryfattah/Ruby
/scripts/log.rb
UTF-8
1,089
3.546875
4
[]
no_license
require 'fileutils' class Journal #Assign variables #file is first commandline argument @@file = ARGV[0] @data = [] #clear screen def clear system "cls" end #create new log file unless file exists def mk_file FileUtils.touch("c:/scripts/logs/#{@@file}.txt") unless File.exists?("c:/scripts/logs/#{@@file}.txt") end ...
true
daa01966b0a1f0b230b253e90ec8ca15e3ac550a
Ruby
mull/torque-postgresql
/lib/torque/postgresql/adapter/oid/interval.rb
UTF-8
3,009
2.828125
3
[ "MIT" ]
permissive
module Torque module PostgreSQL module Adapter module OID class Interval < ActiveModel::Type::Value CAST_PARTS = [:years, :months, :days, :hours, :minutes, :seconds] def type :interval end # Accepts database-style string, numeric as seconds, arr...
true
d86b938705b7fcbdfe21c8d6eb13b4ba5afaa5da
Ruby
tomwot/CodeIQ
/matching_puzzle/trunk/maching_puzzle.rb
UTF-8
162
2.828125
3
[]
no_license
# https://codeiq.jp/q/1682 # プログラマーのためのパズルを解いて m, n = gets.chomp.split.map(&:to_i) pieces = ARGF.map{|line| line.chomp.split}
true
eb309915c3e177837415fd41c4abd2664093f8ac
Ruby
phuesler/payone_connect
/lib/payone_connect.rb
UTF-8
1,522
2.734375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'net/http' require 'net/https' require 'uri' require 'active_support/core_ext/hash/keys' require 'active_support/core_ext/object/blank' class PayoneConnect attr_reader :request_data, :request_header def initialize(api_url, data) @api_url = URI.parse(api_url) @request_data = process_data(data) @...
true
5f55696c27485951313ed4d368ffaa1e696aa298
Ruby
jns/toou
/app/models/promotion.rb
UTF-8
1,634
2.78125
3
[]
no_license
class Promotion < ApplicationRecord include Buyable # Valid statuses DRAFT = "Draft" ACTIVE = "Active" CLOSED = "Closed" validates :status, inclusion: {in: [DRAFT, ACTIVE, CLOSED]} validates :price_cents, numericality: {greater_than_or_equal_to: 0} has_many :passes, a...
true
ebfdb52336a128d7db80fce83d34b3295b5a2db8
Ruby
tomash/talks
/coderslab-20140311-rspec/example2/lib/product.rb
UTF-8
196
3.0625
3
[]
no_license
class Product attr_accessor :price def initialize(category) @price = 10 @category = category end def available? true end def promoted? @category.promoted? end end
true
55b26314a38e4b1760564fd19a8e453dcdcdc3a2
Ruby
JohnDevitt/kegasus
/lib/GreedyAlgorithm.rb
UTF-8
2,056
3.484375
3
[]
no_license
load 'Tour.rb' load 'Manager.rb' class GreedyAlgorithm def generateInitialTour locations initialTour = Array.new initialTour[0] = locations[0] for i in 1..tour.size - 1 closestLocation = locations[0] for j in 0..tour.size - 1 if !(initialTour.include? tour[j]) if ((tou...
true
a3a29726c9981a6e72e03f419df6749b5882dec4
Ruby
sotoseattle/cf_fibonacci
/spec/fibonacci_spec.rb
UTF-8
866
3.625
4
[]
no_license
require 'spec_helper' require 'fibonacci' include Fibonacci describe Fibonacci do describe 'I want the nth number in the fibonacci sequence' do let(:solution) do {0=>0, 1=>1, 2=>1, 3=>2, 4=>3, 5=>5, 6=>8, 7=>13, 8=>21, 9=>34, 10=>55, -1=>1, -2=>-1, -3=>2, -4=>-3, -5=>5, -6=>-8, -7=>13, -8=>-21} ...
true
a23794beb9c4deb4f099364eb973ad0b9d7ba50f
Ruby
danmayer/rails_flaky_spec_examples
/spec/helpers/solved/posts_helper_b_spec.rb
UTF-8
1,853
2.609375
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'rails_helper' # Classification: Time # Success Rate: ~75% # Suite Required: false # Example: Time, As the time comes close to the new year, this will fail # # Description: # Specs in this file are trying to test time changing verifying a change over time. # It is very common to ...
true
7a2bd397e79220395903682cfff555e740699234
Ruby
samaaron/polynome-rb
/lib/polynome/monome.rb
UTF-8
3,419
2.6875
3
[]
no_license
module Polynome class Monome attr_reader :model, :communicator, :carousel, :name # Create a new monome # # @param [Hash] opts the options to create a new monome with # @option opts [Symbol] :cable_placement (:top) The placement of the cable. One of [:top, :bottom, :left, :right]. # @option o...
true
1fe07d08aec79c2623883106c84d1a40be9d6069
Ruby
ChristineEdward/Hello-Ruby
/array.rb
UTF-8
305
3.359375
3
[]
no_license
puts " |+| " puts " ______|+| " puts " ++++++|+|++++++++ " puts " |+| " puts " |+| " items = ["Apple","Banana","Orange"] items << 8 items.push(1) items.insert(5,3) puts items puts ...... a = [2,3,7,8] b = [2,7,9] puts a & b
true
ea0824b43c628a763ae1cc595bc3264af8e19b10
Ruby
nattydodd/object_oriented_programming_part2
/oop_exercise_2/item.rb
UTF-8
3,452
3.5
4
[]
no_license
require_relative 'receipt' class Item attr_reader :name attr_reader :price attr_accessor :sales_tax attr_accessor :total_price @@total_price = 0 @@sales_tax = 0 def total_price return @@total_price end def self.total_price @@total_price end def self.sales_tax @@sales_tax end ...
true
6e8da98ea9a4dd16ba959ae08d0116d79ae17472
Ruby
pbaker2018/Codewar_Katas
/Level_5_katas/First_non_repeating_character.rb
UTF-8
951
4.40625
4
[]
no_license
# QUESTION # Write a function named first_non_repeating_letter that takes a string input, and # returns the first character that is not repeated anywhere in the string. # For example, if given the input 'stress', the function should return 't', # since the letter t only occurs once in the string, and occurs first in th...
true
c58ab7ba9c9b1c5a4c9bb4c8a064ce0ed8a9e287
Ruby
rnhurt/google_anymote
/bin/discover
UTF-8
1,834
2.890625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'socket' require 'timeout' require 'yaml' YAML::ENGINE.yamler='syck' ANYMOTE_PORT = 9101 LISTENER_PORT = 19800 COMMAND = "discover" SERVICE = "_anymote._tcp" # Create a new UDP listener listener = UDPSocket::new( Socket::AF_INET ) listener::setsockopt( Socket::SOL_SOCKET, So...
true
b2ef8ef8e836c59f27ee434c39a4ea45ad5ace43
Ruby
bdhunter3141/jungle-rails
/spec/models/user_spec.rb
UTF-8
4,301
2.6875
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do describe 'Validations' do before :each do User.create({ first_name: 'Larry', last_name: 'Robertsons', email: 'larry@larryandsons.com', password: 'larry649', password_confirmation: 'larry649' }) ...
true
c7767e254df3cf4c46b4dbe55d4b5d9ece7c2256
Ruby
ldlsegovia/organizer
/lib/organizer/group/builder.rb
UTF-8
1,108
2.578125
3
[ "MIT" ]
permissive
module Organizer module Group module Builder include Organizer::Error def self.build(_source_collection, _group_items_collection) return _source_collection if _group_items_collection.blank? groups = Organizer::Group::Collection.new build_recursively(groups, _source_collection,...
true
fe5bb27f5c9612b83540b642b73e3e38fd2cde98
Ruby
DausdasKreuz/ironhack-prework
/Ruby/exer3-FizzBuzz/FizzBuzz2.rb
UTF-8
109
3.515625
4
[]
no_license
(1..100).each do |i| if (i % 3) == 0 puts "Fizz" elsif (i % 5) == 0 puts "Buzz" else puts i end end
true
7d04f51452c09aefd84d4365209ba1a9dfc940db
Ruby
asoesilo/scatterbrain
/app/models/entries/restaurant.rb
UTF-8
1,005
2.65625
3
[]
no_license
class Restaurant include Jsonable attr_reader :id attr_reader :name attr_reader :address attr_reader :city attr_reader :state attr_reader :country attr_reader :phone attr_reader :rating attr_reader :review_count attr_reader :url attr_reader :photo_url attr_accessor :created_at def initializ...
true
2bbdc6342763fb4970e33269eab8e1417102f65c
Ruby
mceachen/shade
/lib/shade/palette.rb
UTF-8
1,678
3.140625
3
[ "MIT" ]
permissive
require 'color' require 'geokdtree' module Shade class Palette def initialize @tree = Geokdtree::Tree.new(3) @empty = true yield self if block_given? end def add(css_color, name = nil) @empty = false value = Value.new(css_color, name) @tree.insert(value.coords, value)...
true
9346a3f49769f8eb2a0ebcf38b9b6a3d8d47997c
Ruby
oolzpishere/children_center
/lib/handle_value.rb
UTF-8
382
3.078125
3
[]
no_license
class HandleValue attr_accessor :compiled_value attr_reader :value def initialize(value) @value = value @compiled_value ||= "" end def get_value if value_is_address? compiled_value = value.values.join(" ") else compiled_value = value end end def value_is_address? valu...
true
125281cc47ce26f73bfcefb28042f93fe2e73fd9
Ruby
trueheart78/book-notes-generator
/lib/config.rb
UTF-8
1,955
2.8125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'yaml' require 'pathname' class Config def initialize(config_path: nil) @config_path = config_path @yaml_data = nil load_yaml end def base_path Pathname.new yaml_data['book_notes_path'] if valid? end def yaml_path @yaml_path ||= generate_path 'yam...
true
9d96f06a7488035e82aeae4eb21db8a2d7093a93
Ruby
department-of-veterans-affairs/vets-api
/lib/pagerduty/models/service.rb
UTF-8
2,604
2.5625
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
# frozen_string_literal: true require 'common/models/base' require 'common/models/attribute_types/iso8601_time' require 'pagerduty/configuration' module PagerDuty module Models class Service include ActiveModel::Validations include Virtus.model(nullify_blank: true) # 5 potential PagerDuty API...
true
99289532181eb5cc645d287f8bfa4676e80993d8
Ruby
tsuyukusa-rk/study_ruby
/learningRuby/memo.rb
UTF-8
244
2.796875
3
[]
no_license
#Ruby のブロックは、簡単にいえばメソッドから呼び出される関数のことです。したがって、Ruby #のイテレータとは、与えられたブロックを呼び出すメソッドということになります。
true
4ba258cd805498527cf3c737f453669c7f719087
Ruby
foberleitner/advent-of-code
/2015/puzzle02/puzzle02.rb
UTF-8
969
3.515625
4
[]
no_license
#!/usr/bin/env ruby -w class Box def initialize(x, y, z) @x = x.to_i @y = y.to_i @z = z.to_i @areas = [@x * @y, @x * @z, @y * @z] end def paper_needed @areas.reduce(0) { |a, e| a + 2 * e } + @areas.min end ## # ribbon needed is smallest circumference + the volume of the box def ribb...
true
380288c75d0527988c418e0445208780f7e5ea87
Ruby
nerab/pegel_online
/lib/pegel_online/command_line/processor.rb
UTF-8
1,843
2.765625
3
[ "MIT" ]
permissive
module PegelOnline module CommandLine module Processor MissingArgument = Class.new(StandardError) do def initialize super("Missing argument. Station is required.") end end def self.present(stations, options = {}) case stations when NilClass ...
true
f5aeea55677e0436503f80fd95fe268571e36596
Ruby
jmettraux/ruote
/lib/ruote/exp/fe_reserve.rb
UTF-8
2,938
2.53125
3
[ "MIT" ]
permissive
#-- # Copyright (c) 2005-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
true
97fc766fea7a6e4157451f12edb643309870b6b2
Ruby
freerange/goos-ruby
/app/xmpp_auction.rb
UTF-8
1,441
2.75
3
[]
no_license
require "announcer" require "auction_message_translator" class XMPPAuction JOIN_COMMAND_FORMAT = "SQLVersion: 1.1; Command: JOIN;" BID_COMMAND_FORMAT = "SQLVersion: 1.1; Command: BID; Price: %d;" def initialize(connection, auction_id, failure_reporter) @auction_event_listeners = Announcer.new @failure_r...
true
616929c5b01f30a3cfd9c70ff7801e851be53ea1
Ruby
betachelsea/sample_rspec
/spec/mocks/expecting_messages.rb
UTF-8
1,644
3.203125
3
[]
no_license
describe "Expecting messages" do let(:cat) { Cat.new } it "nameが呼び出されること" do expect(cat).to receive(:name) cat.name # 呼び出しがなければテスト失敗 end end describe "Spies" do let(:dog) { spy('dog') } it '呼び出したことの確認' do dog.name expect(dog).to have_received(:name) end it '引数の確認' do dog.eat('tomato')...
true
dc3e7da2617dbc786a19a83c84f94b62d8dd378e
Ruby
rochellesagh/learn-co-sandbox
/shoes.rb
UTF-8
326
3.625
4
[]
no_license
#shoe size checker # if shoe size is less than 7 => :( # if shoe size is between 7 && 9.5 ==> "Yay! New Shoes" # if shoe size is over 9.5 => "booooo" shoe_size = 8 if shoe_size <7 puts ":(" end if shoe_size >= 7 && shoe_size <= 9.5 puts "Yay! New Shoes" end if shoe_size > 9.5 puts "booooo"...
true
4a2ad41bb02162c67f1193c84ea9a8783c755b13
Ruby
ubermajestix/lightning
/lib/lightning/parser.rb
UTF-8
1,839
2.71875
3
[]
no_license
module Lightning class Parser class << self # pass :feed for the feed url or file location - required # pass :posts for the number of posts to return - optional # returns an array of Lightning::Post objects def parse(opts={}) raise "need to provide a feed url or file for this to w...
true
2d788615d8800f02ad5b5fdf71f9fd4bba5985f4
Ruby
puyogo-suzuki/mct-joken-texts
/OverviewInformationTechnology/Program1/Ruby/Section1.rb
UTF-8
2,935
3.1875
3
[ "MIT" ]
permissive
def parse(str) ret = /^.(\d+),(\d+)$/.match(str) if ret == nil then ret = /^.(\d+)$/.match(str) if ret == nil then return nil else return [ret.captures[0], (ret.captures[0].to_i + 1).to_s] end else return ret.captures end end def openFile(path) fp =...
true
327f15ecab614a70090d54a7c68aad144170ff99
Ruby
RORvivak/ds_dp_rec
/web_page.rb
UTF-8
1,969
3.234375
3
[]
no_license
class WebPageTraffic def initialize @pages = {} @queries = {} @query_value_mapper = {} @rank = {} end def page_info(info) page_data = {} single_page_data = info.split(" ").uniq page_identifier = "P" + (@pages.length + 1).to_s single_page_data.each_with_index do |e,i| page_data[e.upc...
true
c90f0f1653715eea82407e3b20386bd9fe9f397e
Ruby
aidden-laoch/metasploit-framework
/lib/gemcache/ruby/1.9.1/gems/metasploit_data_models-0.0.2.43DEV/lib/metasploit_data_models/validators/password_is_strong_validator.rb
UTF-8
1,944
3.171875
3
[ "BSD-3-Clause" ]
permissive
class PasswordIsStrongValidator < ActiveModel::EachValidator COMMON_PASSWORDS = %w{ password pass root admin metasploit msf 123456 qwerty abc123 letmein monkey link182 demo changeme test1234 rapid7 } def validate_each(record, attribute, value) return if value.blank? if is_simple?(value) r...
true
f5d3cad75b0880208a0276f02d85951a8c3b01b7
Ruby
RMCornell/enigma_1
/lib/offset.rb
UTF-8
394
3.265625
3
[]
no_license
class Offset attr_reader :date def initialize(date = "020315") @date = date if ARGV[2] @date = ARGV[2] else @date end end def square_date squared = date.to_i ** 2 return squared.to_s.chars end def a_offset square_date[-4].to_i end def b_offset square_date[-3].to_i end def c_offset ...
true
a067b519c737dcc2665a184820d91f3c2f8ee47a
Ruby
ndbroadbent/project_euler
/1/solution.rb
UTF-8
547
3.28125
3
[]
no_license
#!/usr/bin/env ruby # ----------------------------------------- # | A solution to a Project Euler problem | # ----------------------------------------- require 'rubygems' problem_no = File.dirname(File.expand_path(__FILE__)).split('/').last puts "=== Solving Project Euler problem ##{problem_no}" question = %Q{ Find th...
true
6844d349a717160377e5ea7469fb8f94754f6a64
Ruby
ledewitt/sandbox
/clock/lib/clock/time_clock.rb
UTF-8
501
2.59375
3
[]
no_license
require_relative 'time_card.rb' module Clock class TimeClock def initialize(user) @user = user @time_card = Clock::TimeCard.new p "I have #{@user}" end attr_reader :user def format_time(t) t.strftime("%I:%M%P") end def format_date(t) t.strftim...
true
711e06743f06d30267f1edadc18742e503743c50
Ruby
caiodsc1/evaluation_project
/spec/evaluation_spec.rb
UTF-8
3,079
2.921875
3
[]
no_license
RSpec.describe Evaluation do let(:instance) { described_class.new } describe '.methods' do it { is_expected.to respond_to(:build) } it { expect(subject.respond_to?(:evaluate, true)).to eq true } end describe '#build' do subject { instance.build(input) } context 'when given 1' do let(:in...
true
1bd5eb4456b4e14d0de517d20b3f1bfb3f072875
Ruby
jordansissel/experiments
/ruby/grit/grit-example.rb
UTF-8
617
2.75
3
[]
no_license
require "rubygems" require "grit" repo = Grit::Repo.new(".") branch = "master" 5.times do |i| index = repo.index index.add("path/to/thing", "Hello world #{i}\n") head = repo.get_head(branch) if head parents = [head.commit] index.current_tree = head.commit.tree else parents = [] end p :commit ...
true
f54e3384a3c3c243ca3856a4b1dd0728390bb075
Ruby
RobertRodes/RB101
/small_problems/easy_9/ex_9.rb
UTF-8
241
3.65625
4
[]
no_license
def get_grade(g1, g2, g3) avg = (g1 + g2 + g3) / 3.0 if avg < 60 'F' elsif avg < 70 'D' elsif avg < 80 'C' elsif avg < 90 'B' else 'A' end end p get_grade(95, 90, 93) == "A" p get_grade(50, 50, 95) == "D"
true
607649e4f2d438ec43de5a0c7bafc44fab78b37e
Ruby
ggwc82/string_calculator_tech_test
/lib/calculator.rb
UTF-8
435
3.578125
4
[]
no_license
class Calculator def add(string) string = substitute_deliminator(string) cleaned_input = parse_input(string) sum(cleaned_input) end private def parse_input(string) string.gsub("\n", ",") end def sum(array) array.split(",").map(&:to_i).inject(0, :+) end def substitute_deliminator(...
true
824bce474590f62b8443182558a51c90e73cfc85
Ruby
eschen2013/battleship
/players/mojo_player.rb
UTF-8
1,506
3.28125
3
[]
no_license
class MojoPlayer def name "Mojo Player" end def new_game @history = [] @prev_ships_remaining = [] @mode = :hunt [ [1, 1, 5, :across], [1, 2, 4, :down], [8, 1, 3, :down], [1, 8, 3, :across], [7, 8, 2, :across] ] end def take_turn(state, ships_remaini...
true
dbe5abf7799600c7099195022448259ae93acc21
Ruby
phifty/gom
/lib/gom/storage/fetcher.rb
UTF-8
616
2.84375
3
[ "MIT" ]
permissive
# Fetches a draft from the storage adapter and uses the cached builder to build an object from it. class GOM::Storage::Fetcher attr_accessor :id def initialize(id) @id = id end def object fetch_draft return nil unless has_draft? build_object @object end private def fetch_draft ...
true
3669379737ac63528eda9c4bbc27d429581dddf9
Ruby
jpastuszek/unicorn-cuba-base
/lib/unicorn-cuba-base/perf_stats.rb
UTF-8
788
2.578125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'benchmark' $perf_stats_nest_level = -1 $perf_stats_tasks = [] module PerfStats def measure(task, object = nil) if log.perf? begin $perf_stats_nest_level += 1 $perf_stats_tasks << task task = $perf_stats_tasks.join(' -> ') ret = nil took = Benchmark.measure do ret = yield en...
true
66abd4dbf2da4be5dc0d95fecb70588300bae18d
Ruby
italia/pagopa-soap-ruby
/spec/soap/soap_spec.rb
UTF-8
733
2.71875
3
[ "BSD-3-Clause" ]
permissive
# frozen_string_literal: true require "spec_helper" RSpec.describe Soap do describe "to_snakecase" do it "lowercases one word CamelCase" do expect(described_class.to_snakecase("Nodo")).to eq("nodo") end it "makes one underscore snakecase two word CamelCase" do expect( described_clas...
true
06173da4d69a7b724a62ccc3610423a12b1162c9
Ruby
ericovinicosta/pdti-ruby-respostas-exercicio05
/resposta02.rb
UTF-8
433
4.28125
4
[]
no_license
=begin 2. Faça um programa para imprimir: 1 1 2 1 2 3 ..... 1 2 3 ... n para um n informado pelo usuário. Use uma função que receba um valor n inteiro imprima até a n-ésima linha. =end def imprima_linhas (numero) resposta = "" (1..numero).each do |i| (1..i).each do |j| resposta += "#{j}\t" ...
true
a941ddea3d57a4970b10d3f8a6bbdc28c451c64f
Ruby
dk2la/ft_transcendence
/tabletennis/app/models/tournament.rb
UTF-8
1,009
2.828125
3
[]
no_license
class Tournament < ApplicationRecord has_many :tournament_members, class_name: :TournamentMember has_many :pairs, class_name: :Pair # NAME_VALIDATE_REGEX = /[a-zA-Z ]/ # validates :name, presence: true, format: {with: NAME_VALIDATE_REGEX }, length: {minimum: 5, maximum: 15}, uniqueness: true # val...
true
12b3001635f54247344756e6cf55d3d33c6b41a9
Ruby
CX-Checkout/vrlf01
/test/app_test.rb
UTF-8
2,141
2.5625
3
[ "Apache-2.0" ]
permissive
# noinspection RubyResolve,RubyResolve require_relative 'test_helper' require 'logging' Logging.logger.root.appenders = Logging.appenders.stdout class ClientTest < Minitest::Test # Called before every test method runs. Can be used # to set up fixture information. def setup @app = App.new end attr_read...
true
a4456814712ddbe0b18e107bb94d8eb699d5d878
Ruby
ymaqsudi/My_Ruby_Scripts
/random.rb
UTF-8
52
3.59375
4
[]
no_license
puts 'hello' age = gets.chomp puts "you are #{age}"
true
7b88a4e6f9403fbc59b647e552d6ebd5db3a8884
Ruby
samnang/pairing-tour
/simple-spreadsheet/spec/sheet_spec.rb
UTF-8
2,005
3
3
[]
no_license
require 'rubygems' require 'spec' require 'lib/sheet' describe Sheet do context "when empty cell" do it "should return default cell value" do empty_cells = ["A1", "ZX347"] @sheet = Sheet.new verify_cell_value(empty_cells[0]) verify_cell_value(empty_cells[1]) end...
true
12f8126e1ac0a5f8553b85ad8fd4f13f8ea0e176
Ruby
roniPTE/RBPrep
/chap7_hashes/merge.rb
UTF-8
211
2.859375
3
[]
no_license
hash_one = {thing: "one", something: "two"} hash_two = {onething: "three", anotherthing: "four"} temp = hash_one.merge(hash_two) puts temp puts hash_one perm = hash_one.merge!(hash_two) puts perm puts hash_one
true
5d6c32d7596a88c740430dde9cc6e4b086191447
Ruby
EWright212/Scrabble_Solver
/spec/scrabble_spec.rb
UTF-8
663
3.390625
3
[]
no_license
require 'scrabble.rb' describe Scrabble do it 'has a method that returns one for a' do scrabble = Scrabble.new('a') expect(scrabble.score).to eq(1) end it 'has a method that returns 4 for f' do scrabble = Scrabble.new('f') expect(scrabble.score).to eq(4) end it 'has a method that returns...
true
d143b07f2bcc6deeb1ad5ec2beb8762f57ba9bbe
Ruby
Bouterfass/THP
/S4J2V_mini_jeu/app_3.rb
UTF-8
471
2.71875
3
[]
no_license
require 'bundler' Bundler.require require_relative 'lib/game' require_relative 'lib/player' game = Game.new("Youcef") while game.is_still_ongoing? && (game.enemies[0].life_points > 0 || game.enemies[1].life_points > 0 || game.enemies[2].life_points > 0 || game.enemies[3].life_points > 0) system('clear') gam...
true
f8bf43c7c8b2c67996eecac8431dfe06c067a829
Ruby
marcosgz/obfusc
/lib/obfusc/cli.rb
UTF-8
2,293
2.578125
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Obfusc # This model receive and process ARGV from ./exe/obfusc script class CLI VALID_COMMANDS = %w[setup crypt decrypt show].freeze attr_reader :argumetns, :options def initialize(arguments) @arguments = arguments @options = {} end def run ...
true
3efd3a03e0e5d93b7024ca7920d9dbbe0ad6eeed
Ruby
elcuervo/net-ptth
/lib/net/ptth/socket.rb
UTF-8
858
2.796875
3
[ "MIT" ]
permissive
require "celluloid/io" class Net::PTTH SocketError = Class.new(StandardError) Socket = Struct.new(:host, :port) do include Celluloid::IO def read(bytes = 4096*10) raw_socket.readpartial(bytes) end def write(data) retry_count = 3 begin raw_socket.write(data) rescue...
true
2c19cb908bf6239a2df397c82b1d88c2fa49b52b
Ruby
tsubame/KrAntenaFootball
/app/models/entry_get_sns_comments_action.rb
UTF-8
2,231
2.90625
3
[]
no_license
# -*- encoding: UTF-8 -*- require 'open-uri' require 'assets/twitter_searcher' # entriesテーブル内の最近のエントリに対する # SNSでのコメントを取得し、commentsテーブルに保存 # class EntryGetSnsCommentsAction # この時間より前のエントリのコメントは取得しない 24 → 24時間以内の記事のみが対象 MAX_UPDATE_HOUR = 24 # この件数より前のエントリのコメントは取得しない 180 → 最近180件の記事のみが対象 MAX_UPDATE_COUNT = 10...
true
18e6193c8592ff4850cab9ccfed59e445fc47530
Ruby
dominictarr/extra_easy
/tests/examples/test_example3.rb
UTF-8
372
2.59375
3
[]
no_license
require 'rubygems' # require 'minitest' require 'mini/test' require 'adapt_test' class TestExample3 < Mini::Test::TestCase # include AdapterForTest def subject; 7 ; end def default_subject; 7; end def test_mod # puts "subject:#{subject.inspect} -- #{self.class}" assert_equal 7 % subject, 0 assert_equal ...
true
5ad259721e3c83ca98b504c62a82fe992b5bb09f
Ruby
585873/project_2
/sinatra_intro/app.rb
UTF-8
597
2.640625
3
[]
no_license
require 'sinatra' require 'sinatra/reloader' # get "/" do # @num_bottles = 99 # erb :index # end # # get "/bottles/:num" do # @num_bottles = params[:num].to_i # erb :index # end # names = ["bobert", "tom", "missy", "kristy"] # get "/" do # @names = names # erb :index # end # # POST /animals # DELETE /anima...
true
bda89483ca536fe52694d409d41db89def9c77ea
Ruby
conradbeach/food-storage-inventory
/spec/helpers/food_items_helper_spec.rb
UTF-8
1,865
2.9375
3
[]
no_license
# frozen_string_literal: true require "rails_helper" RSpec.describe FoodItemsHelper, type: :helper do describe "#format_units" do context "when the unit type is pounds" do context "when the weight is less than 4 pounds" do it "returns the weight in ounces" do expect(format_units(0.5, "po...
true
1916fe3729cd530011518d65254f93d01d661d60
Ruby
Adri-III/mini_jeu_POO
/app.rb
UTF-8
1,123
3.171875
3
[]
no_license
# Appel les gems de Gemfile : require 'bundler' Bundler.require # Liens appellant les fichiers "game.rb" et "player.rb" situés dans le dossier "lib" : require_relative 'lib/game' require_relative 'lib/player' # Création de nos deux personnages : player1 = Player.new("Josiane") player2 = Player.new("Juan") # Entrée d...
true
6c91802a30dc95ab8515296402905de5c756dc9f
Ruby
jeffplang/streamphish
/lib/setlist_info.rb
UTF-8
4,237
3.109375
3
[]
no_license
require 'readline' require_relative '../config/environment' require_relative 'pnet' class SetlistInfo PNET_API_KEY = '448345A7B7688DDE43D0' def initialize(show) # date should be in the form "2/28/1993" @pnet = PNet.new PNET_API_KEY @show = show #Show.find_by_show_date(date) @sets = [] puts "TR...
true
1e8f32522972d52fb4a4859bda91866b23455ecb
Ruby
arvola/LifePath
/rapid/lib/form/validators.rb
UTF-8
1,916
2.875
3
[ "MIT" ]
permissive
module Rapid module Validators def self.value @value ||= "" end def self.value= val @value = val end def self.required value.to_s.strip.length > 0 end def self.min_length length value.to_s.strip.length == 0 ||...
true
e349090c9470b2fdbc6a2a1bb24abe83debe002e
Ruby
sophie06rae/cartoon-collections-v-000
/cartoon_collections.rb
UTF-8
315
3.15625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def roll_call_dwarves(array) array.each_with_index {|name, index| puts "#{index + 1}. #{name}"} end def summon_captain_planet(array) array.map {|i| i.capitalize << "!"} end def long_planeteer_calls(array) array.any? {|i| i.length > 4 } end def find_the_cheese(array) array.detect {|i| i == "cheddar"} end
true
be24d9a215fdaff59fd7c69d326a1ef1154f3958
Ruby
cheef/config-me
/lib/config-me/definitions_parser.rb
UTF-8
586
2.5625
3
[]
no_license
class ConfigMe::DefinitionsParser def self.parse! breadcrumbs = [], &definitions new(breadcrumbs, &definitions).instance_variable_get(:@node) end def initialize breadcrumbs = [], &definitions @node = ConfigMe::Node.new(breadcrumbs) instance_exec &definitions end private def method_missing ...
true
aa638141e9e3d0c1274e2019aa6da33dd2db9b43
Ruby
hatemile/hatemile-for-ruby
/test/test_common_functions.rb
UTF-8
3,481
2.59375
3
[ "Apache-2.0" ]
permissive
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
true
62ab524c836128d67907f765b6fcc1382c102d98
Ruby
angry-boss/rake
/vendor/bundle/ruby/2.6.0/gems/tins-1.25.0/examples/minsky.rb
UTF-8
2,978
3.171875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'tins' # A small Minsky (register) machine module Minsky class InterpreterError < StandardError; end class ::Proc attr_accessor :interpreter attr_accessor :name def execute interpreter.display_registers(self) call end end class Registers def init...
true
96dde6155d4fb8d15cb2d4c074320ec7e029d100
Ruby
thebravoman/software_engineering_2015
/hm_fix_tests/2015-10-22/b/results/Radostin_Angelov_27_a451aa.rb
UTF-8
460
2.75
3
[]
no_license
file = ARGV[0] finalNames = [] Dir.glob(file + '*').each do |file| names = file.split('/').last.split('_') if names.length == 3 and !names.include? "~" lastname = names[1] if lastname.length == 5 finalNames << [names[0],names[1]] end end end require 'csv' finalNames.sort! {|a, b| -(a <=> b)}...
true
c2f1301b1bd8fcca795841a83e531adac3806764
Ruby
sanzyara/rb-test_rep
/Cars/main.rb
UTF-8
306
2.59375
3
[]
no_license
require_relative 'auto' require_relative 'fleet' def main fleet = Fleet.new fleet.load_from_file("cars-list.json") puts fleet.number_by_brand("BMW") puts fleet.number_by_model("X5 3,0D") puts fleet.consumption_by_brand("BMW") puts fleet.average_consumption() end if __FILE__ == $0 main end
true
81923c04c1f35ab2f7443c238ec8573a1fdb75d8
Ruby
limkokholefork/ruby-cheat
/bundler/Gemfile
UTF-8
2,519
2.515625
3
[]
no_license
# Format of this file documented at: # # bundle help gemfile # Which URL will provide the Gems. Mandatory. source 'https://rubygems.org' ##ruby # Require a ruby version. Optional. # # If the version is not met, abort. # # rvm can use that to automatically change ruby version when entering # a directo...
true
8daa1bf2ed3f98ee6eb69fa504d738f3f52750ae
Ruby
joaomm/JavaExtractor
/extractor/specs/class_definition_spec.rb
UTF-8
3,413
2.59375
3
[]
no_license
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require "#{ROOT}/model/class_definition" describe ClassDefinition do context "storing its information" do before :each do @classdef = ClassDefinition.new end it "should have a name" do @classdef.name = 'class_name' @cla...
true
f5720a00d685a0dd9b792f54b1f34fe4dd63ddff
Ruby
PageLens/omakase
/lib/url_utils.rb
UTF-8
191
2.6875
3
[]
no_license
class UrlUtils def self.append_protocol(url, protocol='http') if url.present? and url !~ /^(http|https):\/\// "#{protocol}://#{url.downcase}" else url end end end
true
59e1afddc4043e0c22f33620bfd7d960c033607a
Ruby
aedwardstx/Simpacity
/lib/SimpacityImporter.rb
UTF-8
5,377
2.640625
3
[]
no_license
#!/usr/bin/env ruby require 'rubygems' require 'mongo' include Mongo gem 'activerecord' require 'active_record' #CHANGE ME TO FIT YOUR ENVIRONMENT!! simpacity_base = '/opt/simpacity-dev' require "#{simpacity_base}/lib/SimpacityExtensionCommon.rb" @min_Bps_for_inclusion = Setting.first.min_bps_for_inclusion / 8 @po...
true
41e4116bd781d0dfd7c138288f51f22f44f1fcc3
Ruby
epitron/scripts
/gem-search
UTF-8
5,300
2.953125
3
[]
no_license
#!/usr/bin/env ruby ################################################################### require 'json' require 'date' require 'epitools/colored' ################################################################### # More API URLs: https://guides.rubygems.org/rubygems-org-api/ RUBYGEMS_SEARCH_URL = "https://rubygems.org...
true
9a21ca03538b062ddf12a521faf324990ab26a99
Ruby
ChrisCoffey/Algo-study
/easy_lc_problems.rb
UTF-8
474
3.75
4
[]
no_license
# Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. # You may assume that each input would have exactly one solution, and you may not use the same element twice. # You can return the answer in any order. def two_sum(nums, target) a = 0 z = nums...
true
3f45b2f9d5e4804910713ac4691dab854a0c92a0
Ruby
fmiopensource/lazyboy
/config_boy.rb
UTF-8
1,219
2.671875
3
[ "MIT" ]
permissive
class ConfigBoy def initialize() end # activates active record for all the dynamically created classes def self.activate_record puts "- initializing ActiveRecord Connections..." ActiveRecord::Base.establish_connection(ConfigBoy.database_info) puts "- ActiveRecord Online!" end # gets the DB co...
true
29b42279c44b2e1007d98a2d7bc12272a4fb1654
Ruby
msmith44/project_euler
/007/problem_7.rb
UTF-8
455
4.0625
4
[]
no_license
# Problem 7 # The prime factors of 13195 are 5, 7, 13 and 29. # What is the largest prime factor of the number 600851475143 ? def is_prime(n) ("1" * n) !~ /^1?$|^(11+?)\1+$/ end counter = 2 i = 3 while(true) do if is_prime(i) counter += 1 if counter == 10001 puts "The 10001st prime is " + i.to...
true
5d68e7d677fe5e9f052d92b84ad668fcdbda21fb
Ruby
tfpractice/tfp_laundr
/spec/shared/washer_instance.rb
UTF-8
2,753
2.6875
3
[]
no_license
shared_examples_for("a washer instance") do describe '#coin_excess?' do before(:each) do washer.claim!(user) washer.fill!(load) end it 'checks if quantity coins inserted will exceeds price ' do expect(washer).to respond_to(:coin_excess?) end context 'when inserting insufficient...
true
5b1f34ee9d228b185a6e6086c115333b4d2090d7
Ruby
antssousa/NerdTrack
/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/user.rb
UTF-8
5,269
2.71875
3
[ "MIT" ]
permissive
require 'digest/sha1' module Clearance module User # Hook for all Clearance::User modules. # # If you need to override parts of Clearance::User, # extend and include à la carte. # # @example # extend ClassMethods # include InstanceMethods # include AttrAccessor # incl...
true
78b17d0e941c126727aae21bc69fb60bffbc8c3a
Ruby
j-falcon122/movie_app
/app/runners/movie_runner.rb
UTF-8
5,342
2.796875
3
[]
no_license
class Runner include CommandPrompt def initialize MovieScraper.load run end def run search_list = search_prompt return no_data_found if search_list.size.zero? movie, theater = get_movie_theater(search_list) get_tickets(movie, theater) end def search_prompt puts "\nSearch by m...
true
7dbc4903d5ab5da2dd9e1e7e4225c72106b44399
Ruby
victor-am/ruby_detective
/lib/ruby_detective/source_representation/entities/base.rb
UTF-8
971
2.546875
3
[ "MIT" ]
permissive
module RubyDetective module SourceRepresentation module Entities class Base ROOT_SIGN_SYMBOL = :"::" def absolute_path? namespace.first == ROOT_SIGN_SYMBOL end def path namespace + [name] end def path_without_root_sign namespac...
true
553ec1625ea279efa49cbe8ead2db2c37feefe31
Ruby
dresselm/Rubot
/bot.rb
UTF-8
4,127
3.0625
3
[]
no_license
#!/usr/bin/ruby #@defined_words = {"Ninjex" => "My master"} @mods = [] @admin = '' require 'socket' # Create connections with the server require 'nokogiri' # Scrape data from websites require 'open-uri' # Open website content (for scraps) require 'rubygems' # Multiple fun things like text require '...
true
9f8b2593ac53cfbe6bb87d3b04b8fc6dd6cbbbf4
Ruby
waldir04/ruby-test
/lib/play_analyzer.rb
UTF-8
981
3.21875
3
[ "MIT" ]
permissive
class PlayAnalyzer def initialize(source_type) @source_type = source_type @source = source_type.source end def words_by_characters name map = {} lines = @source.xpath('//SPEAKER[text()="'+ name +'"]/following-sibling::LINE').to_a lines.each do |line| words = line.content.split(' '...
true