repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/time.rb | lib/coercible/coercer/time.rb | module Coercible
class Coercer
# Coerce Time values
class Time < Object
include TimeCoercions
primitive ::Time
# Passthrough the value
#
# @example
# coercer[DateTime].to_time(time) # => Time object
#
# @param [DateTime] value
#
# @return [Date... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/float.rb | lib/coercible/coercer/float.rb | module Coercible
class Coercer
# Coerce Float values
class Float < Numeric
primitive ::Float
# Passthrough the value
#
# @example
# coercer[Float].to_float(1.0) # => 1.0
#
# @param [Float] value
#
# @return [Integer]
#
# @api public
... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/string.rb | lib/coercible/coercer/string.rb | module Coercible
class Coercer
# Coerce String values
class String < Object
extend Configurable
primitive ::String
config_keys [ :boolean_map ]
TRUE_VALUES = %w[ 1 on t true y yes ].freeze
FALSE_VALUES = %w[ 0 off f false n no ].freeze
BOOLEAN_MAP = ::Hash[ TRUE_VA... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/false_class.rb | lib/coercible/coercer/false_class.rb | module Coercible
class Coercer
# Coerce false values
class FalseClass < Object
primitive ::FalseClass
# Coerce given value to String
#
# @example
# coercer[FalseClass].to_string(false) # => "false"
#
# @param [FalseClass] value
#
# @return [String]
... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/object.rb | lib/coercible/coercer/object.rb | module Coercible
class Coercer
# Coerce Object values
class Object
extend TypeLookup, Options
accept_options :primitive
primitive ::Object
COERCION_METHOD_REGEXP = /\Ato_/.freeze
# Return coercers object
#
# @return [Coercer]
#
# @api private
at... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/integer.rb | lib/coercible/coercer/integer.rb | module Coercible
class Coercer
# Coerce Fixnum values
class Integer < Numeric
extend Configurable
primitive ::Integer
config_keys [ :datetime_format, :datetime_proc, :boolean_map ]
# Return default config for Integer coercer type
#
# @return [Configuration]
#
... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/time_coercions.rb | lib/coercible/coercer/time_coercions.rb | module Coercible
class Coercer
# Common time coercion methods
module TimeCoercions
# Coerce given value to String
#
# @example
# coercer[Time].to_string(time) # => "Wed Jul 20 10:30:41 -0700 2011"
#
# @param [Date,Time,DateTime] value
#
# @return [String]
... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/configurable.rb | lib/coercible/coercer/configurable.rb | module Coercible
class Coercer
module Configurable
# Add configuration-specific option keys to the descendant
#
# @return [self]
#
# @api private
def self.extended(coercer)
coercer.accept_options :config_keys
super
end
# Build configuration object... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/date_time.rb | lib/coercible/coercer/date_time.rb | module Coercible
class Coercer
# Coerce DateTime values
class DateTime < Object
primitive ::DateTime
include TimeCoercions
# Passthrough the value
#
# @example
# coercer[DateTime].to_datetime(datetime) # => DateTime object
#
# @param [DateTime] value
... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/hash.rb | lib/coercible/coercer/hash.rb | module Coercible
class Coercer
# Coerce Hash values
class Hash < Object
primitive ::Hash
TIME_SEGMENTS = [ :year, :month, :day, :hour, :min, :sec ].freeze
# Creates a Time instance from a Hash
#
# Valid keys are: :year, :month, :day, :hour, :min, :sec
#
# @param [H... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/date.rb | lib/coercible/coercer/date.rb | module Coercible
class Coercer
# Coerce Date values
class Date < Object
include TimeCoercions
primitive ::Date
# Passthrough the value
#
# @example
# coercer[DateTime].to_date(date) # => Date object
#
# @param [DateTime] value
#
# @return [Date... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/symbol.rb | lib/coercible/coercer/symbol.rb | module Coercible
class Coercer
# Coerce Symbol values
class Symbol < Object
primitive ::Symbol
# Coerce given value to String
#
# @example
# coercer[Symbol].to_string(:name) # => "name"
#
# @param [Symbol] value
#
# @return [String]
#
# @a... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/numeric.rb | lib/coercible/coercer/numeric.rb | module Coercible
class Coercer
# Base class for all numeric Coercion classes
class Numeric < Object
primitive ::Numeric
# Coerce given value to String
#
# @example
# coercer[Numeric].to_string(Rational(2, 2)) # => "1.0"
#
# @param [Numeric] value
#
# ... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/support/options.rb | lib/support/options.rb | module Coercible
# A module that adds class and instance level options
module Options
Undefined = Class.new.freeze
# Hook called when descendant was extended
#
# @param [Class,Module] descendant
#
# @return [undefined]
#
# @api private
def self.extended(descendant)
descen... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
solnic/coercible | https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/support/type_lookup.rb | lib/support/type_lookup.rb | module Coercible
# A module that adds type lookup to a class
module TypeLookup
TYPE_FORMAT = /\A[A-Z]\w*\z/.freeze
# Set cache ivar on the model
#
# @param [Class] model
#
# @return [undefined]
#
# @api private
def self.extended(model)
model.instance_variable_set('@type_... | ruby | MIT | c076869838531abb5783280da108aa3cbddbd61a | 2026-01-04T17:44:40.075543Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/spec/response_spec.rb | spec/response_spec.rb | require File.dirname(__FILE__) + '/spec_helper'
require File.dirname(__FILE__) + '/../lib/clickatell'
module Clickatell
describe "Response parser" do
before do
Clickatell::API::Error.stubs(:parse).returns(Clickatell::API::Error.new('', ''))
end
before(:each) do
API.test_mode = false
... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/spec/api_spec.rb | spec/api_spec.rb | require File.dirname(__FILE__) + '/spec_helper'
require File.dirname(__FILE__) + '/../lib/clickatell'
class FakeHttp
def start(&block)
yield self
end
end
module Clickatell
describe "API Command" do
before do
@command = API::Command.new('cmdname')
end
after do
Clickatell::API.api_se... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/spec/command_executor_spec.rb | spec/command_executor_spec.rb | require File.dirname(__FILE__) + '/spec_helper'
require File.dirname(__FILE__) + '/../lib/clickatell'
module Clickatell
describe "API::CommandExecutor" do
it "should have test mode" do
executor = API::CommandExecutor.new({}, false, false, :test_mode)
executor.should be_in_test_mode
end
i... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/spec/cli_options_spec.rb | spec/cli_options_spec.rb | require File.dirname(__FILE__) + '/spec_helper'
require File.dirname(__FILE__) + '/../lib/clickatell/utility'
describe "CLI options" do
context "when sending a message" do
it "should allow single recipients" do
options = Clickatell::Utility::Options.parse(%w{07944123456 testing})
options.recipient.s... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/spec/hash_ext_spec.rb | spec/hash_ext_spec.rb | require File.dirname(__FILE__) + '/spec_helper'
require File.dirname(__FILE__) + '/../lib/clickatell'
describe Hash do
it "should return only the keys specified" do
hash = {:a => 'foo', :b => 'bar', :c => 'baz'}
hash.only(:a, :b).should == {:a => 'foo', :b => 'bar'}
end
it "should return only the keys... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/spec/spec_helper.rb | spec/spec_helper.rb | require 'rubygems'
require 'spec'
require 'mocha'
require 'test/unit'
Spec::Runner.configure do |config|
config.mock_with :mocha
end
| ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/clickatell.rb | lib/clickatell.rb | module Clickatelll end
%w( core-ext/hash
clickatell/version
clickatell/api
clickatell/response
).each do |lib|
require File.join(File.dirname(__FILE__), lib)
end | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/core-ext/hash.rb | lib/core-ext/hash.rb | class Hash
# Returns a new hash containing only the keys specified
# that exist in the current hash.
#
# {:a => '1', :b => '2', :c => '3'}.only(:a, :c)
# # => {:a => '1', :c => '3'}
#
# Keys that do not exist in the original hash are ignored.
def only(*keys)
inject( {} ) do |new_hash, (key, value)... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/clickatell/version.rb | lib/clickatell/version.rb | module Clickatell #:nodoc:
module VERSION #:nodoc:
MAJOR = 0
MINOR = 9
TINY = 0
STRING = [MAJOR, MINOR, TINY].join('.')
def self.to_s
STRING
end
end
end
| ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/clickatell/utility.rb | lib/clickatell/utility.rb | module Clickatell
module Utility
end
end
require File.join(File.dirname(__FILE__), *%w[utility/options]) | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/clickatell/response.rb | lib/clickatell/response.rb | require 'yaml'
module Clickatell
# Used to parse HTTP responses returned from Clickatell API calls.
class Response
class << self
PARSE_REGEX = /[A-Za-z0-9]+:.*?(?:(?=[A-Za-z0-9]+:)|$)/
# Returns the HTTP response body data as a hash.
def parse(http_response)
return { 'OK' =... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/clickatell/api.rb | lib/clickatell/api.rb | module Clickatell
# This module provides the core implementation of the Clickatell
# HTTP service.
class API
attr_accessor :auth_options
class << self
# Authenticates using the given credentials and returns an
# API instance with the authentication options set to use the
# resulting ses... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/clickatell/api/command.rb | lib/clickatell/api/command.rb | require "cgi"
module Clickatell
class API
# Represents a Clickatell HTTP gateway command in the form
# of a complete URL (the raw, low-level request).
class Command
API_SERVICE_HOST = 'api.clickatell.com'
def initialize(command_name, service = 'http', opts={})
@command_name = comman... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/clickatell/api/message_status.rb | lib/clickatell/api/message_status.rb | module Clickatell
class API
class MessageStatus
STATUS_MAP = {
'001' => 'Message unknown',
'002' => 'Message queued',
'003' => 'Delivered to gateway',
'004' => 'Received by recipient',
'005' => 'Error with message',
'006' => 'User cancelled messaged ... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/clickatell/api/command_executor.rb | lib/clickatell/api/command_executor.rb | require 'net/http'
require 'net/https'
module Clickatell
class API
class FakeHttpResponse
def body
"test"
end
end
# Used to run commands agains the Clickatell gateway.
class CommandExecutor
def initialize(authentication_hash, secure=false, debug=false, test_mode=false)
... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/clickatell/api/error.rb | lib/clickatell/api/error.rb | module Clickatell
class API
# Clickatell API Error exception.
class Error < StandardError
attr_reader :code, :message
def initialize(code, message)
@code, @message = code, message
end
# Creates a new Error from a Clickatell HTTP response string
# e.g.:
... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
lukeredpath/clickatell | https://github.com/lukeredpath/clickatell/blob/46c792fe2428a371fc01aff87a67e6dd853e8ca2/lib/clickatell/utility/options.rb | lib/clickatell/utility/options.rb | require 'optparse'
require 'ostruct'
module Clickatell
module Utility
class Options #:nodoc:
class << self
def parse(args)
@options = self.default_options
parser = OptionParser.new do |opts|
opts.banner = "Usage: sms [options] recipient(s) message"... | ruby | MIT | 46c792fe2428a371fc01aff87a67e6dd853e8ca2 | 2026-01-04T17:44:39.972988Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/spec/gems_spec.rb | spec/gems_spec.rb | require 'helper'
describe Gems do
after do
Gems.reset
end
context 'when delegating to a client' do
before do
stub_get('/api/v1/gems/rails.json').
to_return(:body => fixture('rails.json'))
end
it 'gets the correct resource' do
Gems.info('rails')
expect(a_get('/api/v1/ge... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/spec/helper.rb | spec/helper.rb | require 'simplecov'
require 'coveralls'
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
SimpleCov.start do
add_filter '/spec/'
minimum_coverage(100) unless RUBY_PLATFORM =~ /java/
end
require 'gems'
require 'rspec'
require 'webmock/rspec'
WebMock.disable_net_connect... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/spec/gems/client_v2_spec.rb | spec/gems/client_v2_spec.rb | require 'helper'
describe Gems::V2::Client do
after do
Gems.reset
end
describe '#info' do
context 'when gem exists' do
before do
stub_get('/api/v2/rubygems/rails/versions/7.0.6.json').to_return(body: fixture('v2/rails-7.0.6.json'))
end
it 'returns some basic information about ... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/spec/gems/request_spec.rb | spec/gems/request_spec.rb | require 'helper'
describe Gems::Request do
after do
Gems.reset
end
describe '#get with redirect' do
before do
response_body = '<html>\r\n<head><title>302 Found</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>302 Found</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n'... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/spec/gems/abstract_client_spec.rb | spec/gems/abstract_client_spec.rb | require 'helper'
describe Gems::AbstractClient do
it "raises NotImplementedError if new isn't overritten" do
FooClient = Class.new do
include Gems::AbstractClient
end
expect { FooClient.new }.to raise_error(NotImplementedError)
end
end
| ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/spec/gems/client_v1_spec.rb | spec/gems/client_v1_spec.rb | require 'helper'
describe Gems::Client do
after do
Gems.reset
end
describe '#new' do
it 'creates a new v1 client' do
client = Gems::V1.new
expect(client).to_not be_nil
expect(client.class).to eq(Gems::V1::Client)
end
end
describe '#info' do
context 'when gem exists' do
... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems.rb | lib/gems.rb | require 'gems/abstract_client'
require 'gems/v1'
require 'gems/v2'
require 'gems/client'
require 'gems/configuration'
module Gems
extend Configuration
include AbstractClient
# Alias for Gems::Client.new
#
# @return [Gems::Client]
def self.new(options = {})
Gems::Client.new(options)
end
end
| ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems/version.rb | lib/gems/version.rb | module Gems
class Version
MAJOR = 1 unless defined? Gems::Version::MAJOR
MINOR = 3 unless defined? Gems::Version::MINOR
PATCH = 0 unless defined? Gems::Version::PATCH
PRE = nil unless defined? Gems::Version::PRE
class << self
# @return [String]
def to_s
[MAJOR, MINOR, PATCH, P... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems/errors.rb | lib/gems/errors.rb | module Gems
class GemError < StandardError; end
class NotFound < GemError; end
end
| ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems/v1.rb | lib/gems/v1.rb | require 'gems/v1/client'
module Gems
module V1
include AbstractClient
# Alias for Gems::V1::Client.new
#
# @return [Gems::V1::Client]
def self.new(options = {})
Gems::V1::Client.new(options)
end
end
end
| ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems/configuration.rb | lib/gems/configuration.rb | require 'gems/version'
require 'rubygems'
require 'yaml'
module Gems
module Configuration
# An array of valid keys in the options hash when configuring a {Gems::Client}
VALID_OPTIONS_KEYS = %i[
host
key
password
user_agent
username
].freeze
# Set the default API endpoin... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems/v2.rb | lib/gems/v2.rb | require 'gems/v2/client'
module Gems
module V2
include AbstractClient
# Alias for Gems::V2::Client.new
#
# @return [Gems::V2::Client]
def self.new(options = {})
Gems::V2::Client.new(options)
end
end
end
| ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems/abstract_client.rb | lib/gems/abstract_client.rb | module Gems
module AbstractClient
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def new(options = {})
raise NotImplementedError.new
end
# Delegate to Gems::Client
def method_missing(method, *args, &block)
return super unless new.r... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems/client.rb | lib/gems/client.rb | module Gems
class Client < V1::Client
end
end
| ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems/request.rb | lib/gems/request.rb | require 'net/http'
require 'rubygems'
require 'open-uri'
require 'gems/errors'
module Gems
module Request
def delete(path, data = {}, content_type = 'application/x-www-form-urlencoded', request_host = host)
request(:delete, path, data, content_type, request_host)
end
def get(path, data = {}, conte... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems/v1/client.rb | lib/gems/v1/client.rb | require 'date'
require 'gems/configuration'
require 'gems/request'
require 'json'
module Gems
module V1
class Client
include Gems::Request
attr_accessor(*Configuration::VALID_OPTIONS_KEYS)
def initialize(options = {})
options = Gems.options.merge(options)
Configuration::VALID_O... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
rubygems/gems | https://github.com/rubygems/gems/blob/6f3e1a6534b135b97b526fb646780d1270fe5c4e/lib/gems/v2/client.rb | lib/gems/v2/client.rb | require 'date'
require 'gems/configuration'
require 'gems/request'
require 'json'
module Gems
module V2
class Client
include Gems::Request
attr_accessor(*Configuration::VALID_OPTIONS_KEYS)
def initialize(options = {})
options = Gems.options.merge(options)
Configuration::VALID_O... | ruby | MIT | 6f3e1a6534b135b97b526fb646780d1270fe5c4e | 2026-01-04T17:44:39.948067Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/rtrace.rb | rtrace.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
require 'ffi'
require 'lib/rtrace'
| ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/examples/hit_tracer_example.rb | examples/hit_tracer_example.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
## Rtrace example hit tracer
## Please see Eucalyptus for a more comprehensive
## example of what is possible with rtrace
$: << File.dirname(__FILE__)
requi... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/examples/syscall_tracer.rb | examples/syscall_tracer.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
## Rtrace example syscall tracer
require 'ffi'
$: << File.dirname(__FILE__)
require 'rtrace'
pid = ARGV[0].to_i
bits = 64
if ARGV.size < 1 or pid == 0
pu... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/lib/rtrace.rb | lib/rtrace.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
RTRACE_VERSION = "1.4"
## This ugly code is from the Ragweed project. It is
## required to support struct style access of FFI fields
module FFIStructInclude... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/crash.rb | Eucalyptus/crash.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
## Crash is a partial MSEC (!exploitable) WinDbg extension
## reimplementation which uses the Rtrace debugging library.
##
## Usage:
##
## Catch a debug even... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/eucalyptus.rb | Eucalyptus/eucalyptus.rb | #!/usr/bin/env ruby
## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
$: << File.dirname(__FILE__)
require 'ffi'
require 'rtrace'
require 'optparse'
require 'ostruct'
require 'open3'
require 'crash'
require '... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/scripts/glibc_malloc.rb | Eucalyptus/scripts/glibc_malloc.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
## Get and print the register states
## Read the size argument to malloc
## Search the heap buffer for a DWORD
log.str "MALLOC() ============================... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/scripts/on_breakpoint.rb | Eucalyptus/scripts/on_breakpoint.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
log.str "your breakpoint hit!"
| ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/scripts/on_free.rb | Eucalyptus/scripts/on_free.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
## on_free example
## Get and print the register states
## Read the size argument to malloc
## Search the heap buffer for a DWORD
log.str "\nFREE() ========... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/scripts/on_attach.rb | Eucalyptus/scripts/on_attach.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
log.str "Attached to process #{@pid}" | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/example_configuration_files/dsl_example.rb | Eucalyptus/example_configuration_files/dsl_example.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the accompanying LICENSE file in the project root folder for terms.
## This is an example of using the Eucalyptus
## configuration DSL for debugging a program.
## It is heavily commented to help you
## understand what it does and... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/utils/linux-symbol.rb | Eucalyptus/utils/linux-symbol.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
## Simple script that uses nm to search for symbol offsets
## This is mainly for validating the parse_elf code
## ruby linux-symbol.rb /usr/local/my_binary 'a... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/utils/elf_reader_example.rb | Eucalyptus/utils/elf_reader_example.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
require 'parse_elf'
require 'pp'
d = ELFReader.new(ARGV[0])
d.phdr.each do |p|
puts sprintf("\n%s", d.get_phdr_name(p))
pp p
end
## The section headers (... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/utils/parse_elf.rb | Eucalyptus/utils/parse_elf.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
## Optional ELF parser for Rtrace/Eucalyptus
## Support (and testing) for x86, x86_64 and ARM
## This is *NOT* a robust ELF parser. It was
## written specific... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/common/common.rb | Eucalyptus/common/common.rb | class Eucalyptus
def which_threads
if threads.size == 1
pid = threads[0].to_i
return
end
puts "Thread IDs:"
threads.each { |h| puts h }
puts "Which thread ID do you want to trace?"
pid = STDIN.gets.chomp.to_i
end
end
| ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/common/output.rb | Eucalyptus/common/output.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the accompanying LICENSE file in the project root folder for terms.
class EucalyptusLog
def initialize(out)
@out = out
end
def str(s)
@out.puts s
end
def hit(addr, function_name)
@out... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
YahooArchive/rtrace | https://github.com/YahooArchive/rtrace/blob/248477f80a4e059f2cf96687823cc8d1b843e11e/Eucalyptus/common/config.rb | Eucalyptus/common/config.rb | ## Copyright 2015,2016, Yahoo! Inc.
## Copyrights licensed under the New BSD License. See the
## accompanying LICENSE file in the project root folder for terms.
class Eucalyptus
## Add a breakpoint
## addr - Address to set the breakpoint on,
## either absolute or from parse_elf
## name - Name of the breakpo... | ruby | BSD-3-Clause | 248477f80a4e059f2cf96687823cc8d1b843e11e | 2026-01-04T17:44:47.121226Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/spec/group_spec.rb | spec/group_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
TOP_LEVEL = self
def foo; end
def bar; end
module Fruity
describe Group do
lambdas = [->{1},->{2}]
it "can be built from lambdas" do
group = Group.new(*lambdas)
group.elements.values.should == lambdas
end
it "can be buil... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/spec/find_thresold.rb | spec/find_thresold.rb | require_relative "../lib/fruity"
power = 15
x = 2
n = 30
min = 1
max = 2
s = 10
n.times.map do
group = Fruity::Group.new(*[->{}] * s, *[->{ 2 + 2 }] * s, :baseline => :none, :samples => 20, :magnify => 1 << power)
means = group.run.stats.map{|s| s[:mean]}
noops = means.first(s).sort
plus = means.last(s).sort
... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/spec/comparison_run_spec.rb | spec/comparison_run_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
module Fruity
describe ComparisonRun do
let(:group) { Group.new ->{1}, ->{2} }
let(:timings){ ([[1.0, 2.0]] * 10).transpose }
subject { @run = ComparisonRun.new(group, timings, nil) }
its(:comparison) { should == {
:mean... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/spec/fruity_spec.rb | spec/fruity_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe Fruity do
it "is able to report that two identical blocks are identical" do
report = Fruity.report(->{ 2 ** 2 }, ->{ 2 ** 2 })
report.factor.should == 1.0
end
it "is able to report very small performance differences" do
repor... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/spec/util_spec.rb | spec/util_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
module Fruity
describe Util do
its(:clock_precision) { should == 1.0e-6 }
its(:proper_time_precision) { should == 4.0e-06 }
describe :sufficient_magnification do
it "returns a big value for a quick (but not trivial)" do
Uti... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/spec/manual_test.rb | spec/manual_test.rb | require_relative "../lib/fruity"
compare do
one { 42.nil? }
two { 42.nil?; 42.nil? }
end
compare do
two { 42.nil?; 42.nil? }
two_again { 42.nil?; 42.nil? }
three { 42.nil?; 42.nil?; 42.nil? }
four { 42.nil?; 42.nil?; 42.nil?; 42.nil? }
five { 42.nil?; 42.nil?; 42.nil?; 42... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/spec/runner_spec.rb | spec/runner_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
module Fruity
describe Runner do
let(:group) { Group.new(:upcase, :downcase, :on => "Hello") }
let(:runner){ Runner.new(group) }
it "runs from a Group" do
run = runner.run(:samples => 42, :magnify => 100, :baseline => :split)
... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/spec/baseline_spec.rb | spec/baseline_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
module Fruity
describe Baseline do
describe "#[]" do
it "returns an object of the right type" do
b = Baseline[Proc.new{ 42 }]
b.class.should == Proc
b.lambda?.should == false
b.call.should == nil
b = ... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'fruity'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/lib/fruity.rb | lib/fruity.rb | require_relative "fruity/base"
extend Fruity | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/lib/fruity/named_block_collector.rb | lib/fruity/named_block_collector.rb | module Fruity
class NamedBlockCollector
def initialize(to_hash)
@to_hash = to_hash
end
def method_missing(method, *args, &block)
super unless args.empty?
@to_hash[method] = block
end
end
end | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/lib/fruity/group.rb | lib/fruity/group.rb | module Fruity
# A group of callable objects
#
class Group
attr_reader :elements
attr_reader :options
# Pass either a list of callable objects, a Hash of names and callable objects
# or an Array of methods names with the option :on specifying which object to call
# them on (or else the method... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/lib/fruity/base.rb | lib/fruity/base.rb | require_relative "baseline"
require_relative "util"
require_relative "runner"
require_relative "comparison_run"
require_relative "group"
require_relative "named_block_collector"
Fruity::GLOBAL_SCOPE = self
module Fruity
DEFAULT_OPTIONS = {
:on => GLOBAL_SCOPE,
:samples => 20,
:disable_gc => f... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/lib/fruity/runner.rb | lib/fruity/runner.rb | module Fruity
class Runner < Struct.new(:group)
attr_reader :options, :delay, :timings, :baselines
def run(options = {})
prepare(options)
yield self if block_given?
sample
end
def feedback
mess = "Running each test " << (options[:magnify] == 1 ? "once." : "#{options[:magnify]... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/lib/fruity/baseline.rb | lib/fruity/baseline.rb | module Fruity
# Utility module for building
# baseline equivalents for callables.
#
module Baseline
extend self
# Returns the baseline for the given callable object
# The signature (number of arguments) and type (proc, ...)
# will be copied as much as possible.
#
def [](exec)
kin... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/lib/fruity/comparison_run.rb | lib/fruity/comparison_run.rb | # encoding: utf-8
module Fruity
class ComparisonRun < Struct.new(:group, :timings, :baselines)
attr_reader :stats
# +timings+ must be an array of size `group.size` of arrays of delays
# or of arrays of [delay, baseline]
#
def initialize(group, timings, baselines)
raise ArgumentError, "Expe... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
marcandre/fruity | https://github.com/marcandre/fruity/blob/d270f6a477861444391ffce86dd20e406fe5f443/lib/fruity/util.rb | lib/fruity/util.rb | require 'benchmark'
module Fruity
# Utility module doing most of the maths
#
module Util
extend self
PROPER_TIME_RELATIVE_ERROR = 0.001
MEASUREMENTS_BY_REALTIME = 2
MEASUREMENTS_BY_PROPER_TIME = 2 * MEASUREMENTS_BY_REALTIME
# Measures the smallest obtainable delta of two time measurements
... | ruby | MIT | d270f6a477861444391ffce86dd20e406fe5f443 | 2026-01-04T17:44:46.522329Z | false |
soveran/syro | https://github.com/soveran/syro/blob/8dc597c19c8aa1446e21a70cfed7fd2890a7176a/test/helper.rb | test/helper.rb | require_relative "../lib/syro"
require "rack/test"
class Driver
include Rack::Test::Methods
def initialize(app)
@app = app
end
def app
@app
end
end
| ruby | MIT | 8dc597c19c8aa1446e21a70cfed7fd2890a7176a | 2026-01-04T17:44:51.789656Z | false |
soveran/syro | https://github.com/soveran/syro/blob/8dc597c19c8aa1446e21a70cfed7fd2890a7176a/test/all.rb | test/all.rb | require "json"
class RackApp
def call(env)
[200, {"Content-Type" => "text/html"}, ["GET /rack"]]
end
end
class MarkdownDeck < Syro::Deck
def markdown(str)
res[Rack::CONTENT_TYPE] = "text/markdown"
res.write(str)
end
end
class DefaultHeaders < Syro::Deck
def default_headers
{ Rack::CONTENT_T... | ruby | MIT | 8dc597c19c8aa1446e21a70cfed7fd2890a7176a | 2026-01-04T17:44:51.789656Z | false |
soveran/syro | https://github.com/soveran/syro/blob/8dc597c19c8aa1446e21a70cfed7fd2890a7176a/lib/syro.rb | lib/syro.rb | # encoding: UTF-8
#
# Copyright (c) 2015 Michel Martens
#
# 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, modify, ... | ruby | MIT | 8dc597c19c8aa1446e21a70cfed7fd2890a7176a | 2026-01-04T17:44:51.789656Z | false |
xrd/ng-rails-csrf | https://github.com/xrd/ng-rails-csrf/blob/3193e99c7db5822f3cb94a8b11cc68bc4792e966/lib/ng-rails-csrf.rb | lib/ng-rails-csrf.rb | require "ng-rails-csrf/version"
module Ng
module Rails
module Csrf
class Engine < ::Rails::Engine
end
end
end
end
| ruby | MIT | 3193e99c7db5822f3cb94a8b11cc68bc4792e966 | 2026-01-04T17:44:51.698774Z | false |
xrd/ng-rails-csrf | https://github.com/xrd/ng-rails-csrf/blob/3193e99c7db5822f3cb94a8b11cc68bc4792e966/lib/ng-rails-csrf/version.rb | lib/ng-rails-csrf/version.rb | module Ng
module Rails
module Csrf
VERSION = "0.1.0"
end
end
end
| ruby | MIT | 3193e99c7db5822f3cb94a8b11cc68bc4792e966 | 2026-01-04T17:44:51.698774Z | false |
ankane/trend-ruby | https://github.com/ankane/trend-ruby/blob/a8c01d4327231db4044f672b18a0f73dbb7c6980/test/trend_test.rb | test/trend_test.rb | require_relative "test_helper"
class TrendTest < Minitest::Test
def test_anomalies
series = {}
date = Date.parse("2018-04-01")
28.times do
series[date] = rand(100)
date += 1
end
series[date - 13] = nil # test nil
series[date - 8] = 999
assert_equal [Date.parse("2018-04-21")],... | ruby | MIT | a8c01d4327231db4044f672b18a0f73dbb7c6980 | 2026-01-04T17:44:55.176641Z | false |
ankane/trend-ruby | https://github.com/ankane/trend-ruby/blob/a8c01d4327231db4044f672b18a0f73dbb7c6980/test/test_helper.rb | test/test_helper.rb | require "bundler/setup"
Bundler.require(:default)
require "minitest/autorun"
Trend.url ||= "http://localhost:8000"
| ruby | MIT | a8c01d4327231db4044f672b18a0f73dbb7c6980 | 2026-01-04T17:44:55.176641Z | false |
ankane/trend-ruby | https://github.com/ankane/trend-ruby/blob/a8c01d4327231db4044f672b18a0f73dbb7c6980/lib/trend.rb | lib/trend.rb | # stdlib
require "date"
require "json"
require "net/http"
require "time"
# modules
require_relative "trend/client"
require_relative "trend/version"
module Trend
class Error < StandardError; end
def self.anomalies(*args)
client.anomalies(*args)
end
def self.forecast(*args)
client.forecast(*args)
en... | ruby | MIT | a8c01d4327231db4044f672b18a0f73dbb7c6980 | 2026-01-04T17:44:55.176641Z | false |
ankane/trend-ruby | https://github.com/ankane/trend-ruby/blob/a8c01d4327231db4044f672b18a0f73dbb7c6980/lib/trend/version.rb | lib/trend/version.rb | module Trend
VERSION = "0.3.0"
end
| ruby | MIT | a8c01d4327231db4044f672b18a0f73dbb7c6980 | 2026-01-04T17:44:55.176641Z | false |
ankane/trend-ruby | https://github.com/ankane/trend-ruby/blob/a8c01d4327231db4044f672b18a0f73dbb7c6980/lib/trend/client.rb | lib/trend/client.rb | require "trend/version"
module Trend
class Client
HEADERS = {
"Content-Type" => "application/json",
"Accept" => "application/json",
"User-Agent" => "trend-ruby/#{Trend::VERSION}"
}
def initialize(url: nil, api_key: nil, timeout: 30)
@api_key = api_key || Trend.api_key
url |... | ruby | MIT | a8c01d4327231db4044f672b18a0f73dbb7c6980 | 2026-01-04T17:44:55.176641Z | false |
cyrusstoller/RevTilt | https://github.com/cyrusstoller/RevTilt/blob/c3fd80e411c3de72e9c9479474774d6cdcab888d/app/helpers/reviews_helper.rb | app/helpers/reviews_helper.rb | module ReviewsHelper
end
| ruby | MIT | c3fd80e411c3de72e9c9479474774d6cdcab888d | 2026-01-04T17:44:55.378213Z | false |
cyrusstoller/RevTilt | https://github.com/cyrusstoller/RevTilt/blob/c3fd80e411c3de72e9c9479474774d6cdcab888d/app/helpers/application_helper.rb | app/helpers/application_helper.rb | module ApplicationHelper
def bootstrap_alert_type(type)
case type
when :alert, "alert"
"danger"
when :error, "error"
"danger"
when :notice, "notice"
"warning"
when :success, "success"
"success"
else
type.to_s
end
end
def title
base_title = "RevTilt"... | ruby | MIT | c3fd80e411c3de72e9c9479474774d6cdcab888d | 2026-01-04T17:44:55.378213Z | false |
cyrusstoller/RevTilt | https://github.com/cyrusstoller/RevTilt/blob/c3fd80e411c3de72e9c9479474774d6cdcab888d/app/helpers/pages_helper.rb | app/helpers/pages_helper.rb | module PagesHelper
def bookmarklet_javascript(service = nil, new_window = nil)
"javascript:(function(){__script=document.createElement('SCRIPT');__script.type='text/javascript';__script.src='#{bookmarklet_url(:service => service, :format => :js, :new_window => new_window)}';document.getElementsByTagName('head')[0... | ruby | MIT | c3fd80e411c3de72e9c9479474774d6cdcab888d | 2026-01-04T17:44:55.378213Z | false |
cyrusstoller/RevTilt | https://github.com/cyrusstoller/RevTilt/blob/c3fd80e411c3de72e9c9479474774d6cdcab888d/app/helpers/organizations_helper.rb | app/helpers/organizations_helper.rb | module OrganizationsHelper
end
| ruby | MIT | c3fd80e411c3de72e9c9479474774d6cdcab888d | 2026-01-04T17:44:55.378213Z | false |
cyrusstoller/RevTilt | https://github.com/cyrusstoller/RevTilt/blob/c3fd80e411c3de72e9c9479474774d6cdcab888d/app/helpers/relationships/organization_users_helper.rb | app/helpers/relationships/organization_users_helper.rb | module Relationships::OrganizationUsersHelper
end
| ruby | MIT | c3fd80e411c3de72e9c9479474774d6cdcab888d | 2026-01-04T17:44:55.378213Z | false |
cyrusstoller/RevTilt | https://github.com/cyrusstoller/RevTilt/blob/c3fd80e411c3de72e9c9479474774d6cdcab888d/app/helpers/api/v1/pages_helper.rb | app/helpers/api/v1/pages_helper.rb | module Api::V1::PagesHelper
end
| ruby | MIT | c3fd80e411c3de72e9c9479474774d6cdcab888d | 2026-01-04T17:44:55.378213Z | false |
cyrusstoller/RevTilt | https://github.com/cyrusstoller/RevTilt/blob/c3fd80e411c3de72e9c9479474774d6cdcab888d/app/helpers/api/v1/organizations_helper.rb | app/helpers/api/v1/organizations_helper.rb | module Api::V1::OrganizationsHelper
end
| ruby | MIT | c3fd80e411c3de72e9c9479474774d6cdcab888d | 2026-01-04T17:44:55.378213Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.