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
grosser/ruco
https://github.com/grosser/ruco/blob/fb4943b0f554d8f68de6d047591bf882af62bb42/lib/ruco/core_ext/file.rb
lib/ruco/core_ext/file.rb
class File def self.write(to, content) File.open(to, 'wb'){|f| f.write(content) } end # Open files in binary mode. On linux this is ignored by ruby. # On Windows ruby open files in text mode by default, so it replaces \r with \n, # so the specs fail. If files are opened in binary mode, which is the onl...
ruby
MIT
fb4943b0f554d8f68de6d047591bf882af62bb42
2026-01-04T17:44:33.904693Z
false
grosser/ruco
https://github.com/grosser/ruco/blob/fb4943b0f554d8f68de6d047591bf882af62bb42/lib/ruco/core_ext/string.rb
lib/ruco/core_ext/string.rb
class String def naive_split(pattern) Dispel::Tools.naive_split(self, pattern) end def tabs_to_spaces! gsub!("\t",' ' * Ruco::TAB_SIZE) end def leading_whitespace match(/^\s*/)[0] end def leading_whitespace=(whitespace) sub!(/^\s*/, whitespace) end # stub for 1.8 unless method_de...
ruby
MIT
fb4943b0f554d8f68de6d047591bf882af62bb42
2026-01-04T17:44:33.904693Z
false
grosser/ruco
https://github.com/grosser/ruco/blob/fb4943b0f554d8f68de6d047591bf882af62bb42/lib/ruco/core_ext/object.rb
lib/ruco/core_ext/object.rb
class Object # copy from active_support def delegate(*methods) options = methods.pop unless options.is_a?(Hash) && to = options[:to] raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter)." end method...
ruby
MIT
fb4943b0f554d8f68de6d047591bf882af62bb42
2026-01-04T17:44:33.904693Z
false
grosser/ruco
https://github.com/grosser/ruco/blob/fb4943b0f554d8f68de6d047591bf882af62bb42/lib/ruco/core_ext/hash.rb
lib/ruco/core_ext/hash.rb
class Hash # 1.9 does not want index and 1.8 does not have key alias_method(:key, :index) unless method_defined?(:key) # http://www.ruby-forum.com/topic/149449 def slice(*keys, &block) if block each do |key, val| boolean = block.call(key, val) keys << key if boolean end end ...
ruby
MIT
fb4943b0f554d8f68de6d047591bf882af62bb42
2026-01-04T17:44:33.904693Z
false
grosser/ruco
https://github.com/grosser/ruco/blob/fb4943b0f554d8f68de6d047591bf882af62bb42/playground/benchmark_syntax_parser.rb
playground/benchmark_syntax_parser.rb
$LOAD_PATH << 'lib' require 'language_sniffer' gem 'plist' require 'plist' gem 'textpow' require 'textpow' gem 'ultraviolet1x' require 'uv' file = ARGV[0] text = File.read(file) language = LanguageSniffer.detect(file).language require 'ruco/syntax_parser' require 'ruco/array_processor' t = Time.now.to_f Ruco::SyntaxP...
ruby
MIT
fb4943b0f554d8f68de6d047591bf882af62bb42
2026-01-04T17:44:33.904693Z
false
adrienkohlbecker/vagrant-fsnotify
https://github.com/adrienkohlbecker/vagrant-fsnotify/blob/2a0b7ac75efdfaf4afa88cffb1eb675686d0098b/lib/vagrant-fsnotify.rb
lib/vagrant-fsnotify.rb
require "vagrant-fsnotify/version" require "vagrant-fsnotify/plugin" module VagrantPlugins module Fsnotify end end
ruby
MIT
2a0b7ac75efdfaf4afa88cffb1eb675686d0098b
2026-01-04T17:44:39.781165Z
false
adrienkohlbecker/vagrant-fsnotify
https://github.com/adrienkohlbecker/vagrant-fsnotify/blob/2a0b7ac75efdfaf4afa88cffb1eb675686d0098b/lib/vagrant-fsnotify/config-fsnotify.rb
lib/vagrant-fsnotify/config-fsnotify.rb
begin require "vagrant" rescue LoadError raise "The vagrant-fsnotify plugin must be run within Vagrant." end if Vagrant::VERSION < "1.7.3" raise <<-ERROR The vagrant-fsnotify plugin is only compatible with Vagrant 1.7.3+. If you can't upgrade, consider installing an old version of vagrant-fsnotify with: $ vagr...
ruby
MIT
2a0b7ac75efdfaf4afa88cffb1eb675686d0098b
2026-01-04T17:44:39.781165Z
false
adrienkohlbecker/vagrant-fsnotify
https://github.com/adrienkohlbecker/vagrant-fsnotify/blob/2a0b7ac75efdfaf4afa88cffb1eb675686d0098b/lib/vagrant-fsnotify/version.rb
lib/vagrant-fsnotify/version.rb
module VagrantPlugins module Fsnotify VERSION = "0.3.2" end end
ruby
MIT
2a0b7ac75efdfaf4afa88cffb1eb675686d0098b
2026-01-04T17:44:39.781165Z
false
adrienkohlbecker/vagrant-fsnotify
https://github.com/adrienkohlbecker/vagrant-fsnotify/blob/2a0b7ac75efdfaf4afa88cffb1eb675686d0098b/lib/vagrant-fsnotify/command-fsnotify.rb
lib/vagrant-fsnotify/command-fsnotify.rb
require 'listen' module VagrantPlugins::Fsnotify class Command < Vagrant.plugin("2", :command) include Vagrant::Action::Builtin::MixinSyncedFolders def self.synopsis 'forwards filesystem events to virtual machine' end def execute @logger = Log4r::Logger.new("vagrant::commands::fsnotify"...
ruby
MIT
2a0b7ac75efdfaf4afa88cffb1eb675686d0098b
2026-01-04T17:44:39.781165Z
false
adrienkohlbecker/vagrant-fsnotify
https://github.com/adrienkohlbecker/vagrant-fsnotify/blob/2a0b7ac75efdfaf4afa88cffb1eb675686d0098b/lib/vagrant-fsnotify/plugin.rb
lib/vagrant-fsnotify/plugin.rb
begin require "vagrant" rescue LoadError raise "The vagrant-fsnotify plugin must be run within Vagrant." end if Vagrant::VERSION < "1.7.3" raise <<-ERROR The vagrant-fsnotify plugin is only compatible with Vagrant 1.7.3+. If you can't upgrade, consider installing an old version of vagrant-fsnotify with: $ vagr...
ruby
MIT
2a0b7ac75efdfaf4afa88cffb1eb675686d0098b
2026-01-04T17:44:39.781165Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/spec_helper.rb
spec/spec_helper.rb
if RUBY_ENGINE == "rbx" require "codeclimate-test-reporter" CodeClimate::TestReporter.start end require 'coercible' require 'rspec/its' include Coercible ENV['TZ'] = 'UTC' Dir[File.expand_path('../shared/**/*.rb', __FILE__)].each { |file| require file } Dir[File.expand_path('../support/**/*.rb', __FILE__)].each...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/support/mutant.rb
spec/support/mutant.rb
module Mutant class Subject def tests config.integration.all_tests end end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/integration/configuring_coercers_spec.rb
spec/integration/configuring_coercers_spec.rb
require 'spec_helper' describe "Configuring coercers" do it "allows to configure coercers" do coercer = Coercer.new do |config| config.string.boolean_map = { 'yup' => true, 'nope' => false } end expect(coercer[String].to_boolean('yup')).to be(true) expect(coercer[String].to_boolean('nope')).to...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/configuration/class_methods/build_spec.rb
spec/unit/coercible/configuration/class_methods/build_spec.rb
require 'spec_helper' describe Configuration, '.build' do subject { described_class.build(keys) } let(:keys) { [ :foo, :bar ] } it { is_expected.to be_instance_of(described_class) } it { is_expected.to respond_to(:foo) } it { is_expected.to respond_to(:foo=) } it { is_expected.to respond_to(:bar) } i...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string_spec.rb
spec/unit/coercible/coercer/string_spec.rb
require 'spec_helper' describe Coercer::String do it_behaves_like 'Configurable' do describe '.config_name' do subject { described_class.config_name } it { is_expected.to be(:string) } end end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/element_reader_spec.rb
spec/unit/coercible/coercer/element_reader_spec.rb
require 'spec_helper' describe Coercer, '#[]' do subject { object[type] } let(:object) { described_class.new } context "with a known type" do let(:type) { ::String } it { is_expected.to be_instance_of(Coercer::String) } end context "with an unknown type" do let(:type) { Object } it { is_...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/integer_spec.rb
spec/unit/coercible/coercer/integer_spec.rb
require 'spec_helper' describe Coercer::Integer do it_behaves_like 'Configurable' do describe '.config_name' do subject { described_class.config_name } it { is_expected.to be(:integer) } end end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/coerced_predicate_spec.rb
spec/unit/coercible/coercer/string/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::String, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { 'a string' } let(:non_primitive_value) { :a_symbol } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/to_integer_spec.rb
spec/unit/coercible/coercer/string/to_integer_spec.rb
require 'spec_helper' describe Coercer::String, '.to_integer' do subject { described_class.new.to_integer(string) } min_float = Float::MIN max_float = (Float::MAX / 10).to_s.to_f # largest float that can be parsed { '1' => 1, '+1' => 1, '-1' => -1, '1.0' ...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/to_datetime_spec.rb
spec/unit/coercible/coercer/string/to_datetime_spec.rb
require 'spec_helper' shared_examples_for 'a correct datetime object' do it { is_expected.to be_instance_of(DateTime) } its(:year) { should == year } its(:month) { should == month } its(:day) { should == day } its(:hour) { should == hour } its(:min) { should == min } its(:sec) { should == ...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/to_time_spec.rb
spec/unit/coercible/coercer/string/to_time_spec.rb
require 'spec_helper' shared_examples_for 'a correct time object' do it { is_expected.to be_instance_of(Time) } its(:year) { should == year } its(:month) { should == month } its(:day) { should == day } its(:hour) { should == hour } its(:min) { should == min } its(:sec) { should == sec } ...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/to_boolean_spec.rb
spec/unit/coercible/coercer/string/to_boolean_spec.rb
require 'spec_helper' describe Coercer::String, '.to_boolean' do subject { object.to_boolean(string) } let(:object) { described_class.new } %w[ 1 on ON t true T TRUE y yes Y YES ].each do |value| context "with #{value.inspect}" do let(:string) { value } it { is_expected.to be(true) } end ...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/to_date_spec.rb
spec/unit/coercible/coercer/string/to_date_spec.rb
require 'spec_helper' describe Coercer::String, '.to_date' do subject { object.to_date(string) } let(:object) { described_class.new } context 'with a valid date string' do let(:string) { 'July, 22th, 2011' } it { is_expected.to be_instance_of(Date) } its(:year) { should == 2011 } its(:month)...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/to_decimal_spec.rb
spec/unit/coercible/coercer/string/to_decimal_spec.rb
require 'spec_helper' describe Coercer::String, '.to_decimal' do subject { object.to_decimal(string) } let(:object) { described_class.new } { '1' => BigDecimal('1.0'), '+1' => BigDecimal('1.0'), '-1' => BigDecimal('-1.0'), '1.0' => BigDecimal('1.0'), '1.0e+1' => BigDeci...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/to_float_spec.rb
spec/unit/coercible/coercer/string/to_float_spec.rb
require 'spec_helper' describe Coercer::String, '.to_float' do subject { described_class.new.to_float(string) } { '1' => 1.0, '+1' => 1.0, '-1' => -1.0, '1.0' => 1.0, '1.0e+1' => 10.0, '1.0e-1' => 0.1, '1.0E+1' => 10.0, '1.0E-1' => 0.1, '+1.0' => 1.0,...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/to_constant_spec.rb
spec/unit/coercible/coercer/string/to_constant_spec.rb
require 'spec_helper' describe Coercer::String, '.to_constant' do subject { object.to_constant(string) } let(:object) { described_class.new } context 'with a non-namespaced name' do let(:string) { 'String' } it { is_expected.to be(String) } end context 'with a non-namespaced qualified name' do ...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/to_symbol_spec.rb
spec/unit/coercible/coercer/string/to_symbol_spec.rb
require 'spec_helper' describe Coercer::String, '.to_symbol' do subject { described_class.new.to_symbol(value) } let(:value) { 'value' } it { is_expected.to be(:value) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/string/class_methods/config_spec.rb
spec/unit/coercible/coercer/string/class_methods/config_spec.rb
require 'spec_helper' describe Coercer::String, '.config' do subject { described_class.config } its(:boolean_map) { should be(described_class::BOOLEAN_MAP) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/configurable/config_name_spec.rb
spec/unit/coercible/coercer/configurable/config_name_spec.rb
require 'spec_helper' describe Coercer::Configurable, '.config_name' do subject { object.config_name } let(:object) { Class.new { extend Coercer::Configurable, Options config_keys [ :one, :two ] def self.name "Some::Class::Test" end } } it { is_expected.to be(:test) ...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/configurable/config_spec.rb
spec/unit/coercible/coercer/configurable/config_spec.rb
require 'spec_helper' describe Coercer::Configurable, '.config' do subject { object.config(&block) } let(:object) { Class.new { extend Coercer::Configurable, Options config_keys [ :one, :two ] } } let(:block) { Proc.new { |config| config.test } } let(:configuration) ...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/hash/coerced_predicate_spec.rb
spec/unit/coercible/coercer/hash/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::Hash, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { Hash.new } let(:non_primitive_value) { 'other' } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/hash/to_datetime_spec.rb
spec/unit/coercible/coercer/hash/to_datetime_spec.rb
require 'spec_helper' describe Coercer::Hash, '.to_datetime' do subject { object.to_datetime(hash) } let(:object) { described_class.new } context 'when time segments are missing' do let(:time_now) { Time.local(2011, 1, 1) } let(:hash) { {} } before do allow(Time).to r...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/hash/to_time_spec.rb
spec/unit/coercible/coercer/hash/to_time_spec.rb
require 'spec_helper' describe Coercer::Hash, '.to_time' do subject { object.to_time(hash) } let(:object) { described_class.new } context 'when time segments are missing' do let(:time_now) { Time.local(2011, 1, 1) } let(:hash) { {} } before do allow(Time).to receive(:...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/hash/to_date_spec.rb
spec/unit/coercible/coercer/hash/to_date_spec.rb
require 'spec_helper' describe Coercer::Hash, '.to_date' do subject { object.to_date(hash) } let(:object) { described_class.new } context 'when time segments are missing' do let(:time_now) { Time.local(2011, 1, 1) } let(:hash) { {} } before do allow(Time).to receive(:...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/true_class/coerced_predicate_spec.rb
spec/unit/coercible/coercer/true_class/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::TrueClass, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { true } let(:non_primitive_value) { false } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/true_class/to_string_spec.rb
spec/unit/coercible/coercer/true_class/to_string_spec.rb
require 'spec_helper' describe Coercer::TrueClass, '.to_string' do subject { object.to_string(true_class) } let(:object) { described_class.new } let(:true_class) { true } it { is_expected.to be_instance_of(String) } it { is_expected.to eql('true') } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/date/coerced_predicate_spec.rb
spec/unit/coercible/coercer/date/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::Date, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { Date.new } let(:non_primitive_value) { 'other' } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/date/to_datetime_spec.rb
spec/unit/coercible/coercer/date/to_datetime_spec.rb
require 'spec_helper' describe Coercer::Date, '.to_datetime' do subject { object.to_datetime(date) } let(:object) { described_class.new } let(:date) { Date.new(2011, 1, 1) } context 'when Date does not support #to_datetime' do if RUBY_VERSION < '1.9' before do expect(date).not_to res...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/date/to_time_spec.rb
spec/unit/coercible/coercer/date/to_time_spec.rb
require 'spec_helper' describe Coercer::Date, '.to_time' do subject { object.to_time(date) } let(:object) { described_class.new } let(:date) { Date.new(2011, 1, 1) } it { is_expected.to be_instance_of(Time) } it { is_expected.to eql(Time.local(2011, 1, 1)) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/date/to_date_spec.rb
spec/unit/coercible/coercer/date/to_date_spec.rb
require 'spec_helper' describe Coercer::Date, '.to_date' do subject { object.to_date(date) } let(:object) { described_class.new } let(:date) { Date.new(2012, 1, 1) } it { is_expected.to equal(date) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/date/to_string_spec.rb
spec/unit/coercible/coercer/date/to_string_spec.rb
require 'spec_helper' describe Coercer::Date, '.to_string' do subject { object.to_string(date) } let(:object) { described_class.new } let(:date) { Date.new(2011, 1, 1) } it { is_expected.to be_instance_of(String) } it { is_expected.to eql('2011-01-01') } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/float/coerced_predicate_spec.rb
spec/unit/coercible/coercer/float/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::Float, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { 1.2 } let(:non_primitive_value) { 'other' } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/float/to_integer_spec.rb
spec/unit/coercible/coercer/float/to_integer_spec.rb
require 'spec_helper' describe Coercer::Float, '.to_integer' do subject { object.to_integer(float) } let(:object) { described_class.new } let(:float) { 1.0 } it { is_expected.to be_kind_of(Integer) } it { is_expected.to eql(1) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/float/to_datetime_spec.rb
spec/unit/coercible/coercer/float/to_datetime_spec.rb
require 'spec_helper' describe Coercer::Float, '#to_float' do subject { object.to_datetime(value) } let(:object) { described_class.new } let(:value) { 1361036672.12 } specify do expect(subject.strftime('%Y-%m-%d %H:%M:%S.%L')).to eql('2013-02-16 17:44:32.120') end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/float/to_decimal_spec.rb
spec/unit/coercible/coercer/float/to_decimal_spec.rb
require 'spec_helper' describe Coercer::Float, '.to_decimal' do subject { object.to_decimal(float) } let(:object) { described_class.new } let(:float) { 1.0 } it { is_expected.to be_instance_of(BigDecimal) } it { is_expected.to eql(BigDecimal('1.0')) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/float/to_string_spec.rb
spec/unit/coercible/coercer/float/to_string_spec.rb
require 'spec_helper' describe Coercer::Float, '.to_string' do subject { object.to_string(float) } let(:object) { described_class.new } let(:float) { 1.0 } it { is_expected.to be_instance_of(String) } it { is_expected.to eql('1.0') } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/float/to_float_spec.rb
spec/unit/coercible/coercer/float/to_float_spec.rb
require 'spec_helper' describe Coercer::Float, '.to_float' do subject { described_class.new.to_float(value) } let(:value) { 1.0 } it { is_expected.to be(value) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/class_methods/new_spec.rb
spec/unit/coercible/coercer/class_methods/new_spec.rb
require 'spec_helper' describe Coercer, '.new' do subject { described_class.new(&block) } let(:block) { Proc.new {} } it { is_expected.to be_instance_of(Coercer) } its(:config) { should be_instance_of(Coercible::Configuration) } its(:config) { should respond_to(:string) } its(:config) { should respond_t...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/integer/coerced_predicate_spec.rb
spec/unit/coercible/coercer/integer/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::Integer, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { 1 } let(:non_primitive_value) { 1.0 } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/integer/to_integer_spec.rb
spec/unit/coercible/coercer/integer/to_integer_spec.rb
require 'spec_helper' describe Coercer::Integer, '.to_integer' do subject { described_class.new.to_integer(value) } let(:value) { 1 } it { is_expected.to be(value) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/integer/to_datetime_spec.rb
spec/unit/coercible/coercer/integer/to_datetime_spec.rb
require 'spec_helper' describe Coercer::Integer, '#to_datetime' do subject { object.to_datetime(value) } let(:object) { described_class.new } let(:value) { 1361036672 } specify do expect(subject.strftime('%Y-%m-%d %H:%M:%S.%L')).to eql('2013-02-16 17:44:32.000') end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/integer/datetime_format_spec.rb
spec/unit/coercible/coercer/integer/datetime_format_spec.rb
require 'spec_helper' describe Coercer::Integer, '#datetime_format' do subject { object.datetime_format } let(:object) { described_class.new } context "with Rubinius" do before do unless Coercible.rbx? allow(Coercible).to receive_messages(:rbx? => true) end end it { is_expected...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/integer/to_boolean_spec.rb
spec/unit/coercible/coercer/integer/to_boolean_spec.rb
require 'spec_helper' describe Coercer::Integer, '.to_boolean' do subject { object.to_boolean(fixnum) } let(:object) { described_class.new } context 'when the fixnum is 1' do let(:fixnum) { 1 } it { is_expected.to be(true) } end context 'when the fixnum is 0' do let(:fixnum) { 0 } it { i...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/integer/datetime_proc_spec.rb
spec/unit/coercible/coercer/integer/datetime_proc_spec.rb
require 'spec_helper' describe Coercer::Integer, '#datetime_proc' do subject { object.datetime_proc } let(:object) { described_class.new } context "with Rubinius" do before do unless Coercible.rbx? allow(Coercible).to receive_messages(:rbx? => true) end end it { is_expected.to ...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/integer/to_decimal_spec.rb
spec/unit/coercible/coercer/integer/to_decimal_spec.rb
require 'spec_helper' describe Coercer::Integer, '.to_decimal' do subject { object.to_decimal(fixnum) } let(:object) { described_class.new } let(:fixnum) { 1 } it { is_expected.to be_instance_of(BigDecimal) } it { is_expected.to eql(BigDecimal('1.0')) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/integer/to_string_spec.rb
spec/unit/coercible/coercer/integer/to_string_spec.rb
require 'spec_helper' describe Coercer::Integer, '.to_string' do subject { object.to_string(integer) } let(:object) { described_class.new } let(:integer) { 1 } it { is_expected.to be_instance_of(String) } it { is_expected.to eql('1') } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/integer/to_float_spec.rb
spec/unit/coercible/coercer/integer/to_float_spec.rb
require 'spec_helper' describe Coercer::Integer, '.to_float' do subject { object.to_float(fixnum) } let(:object) { described_class.new } let(:fixnum) { 1 } it { is_expected.to be_instance_of(Float) } it { is_expected.to eql(1.0) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/false_class/coerced_predicate_spec.rb
spec/unit/coercible/coercer/false_class/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::FalseClass, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { false } let(:non_primitive_value) { 'other' } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/false_class/to_string_spec.rb
spec/unit/coercible/coercer/false_class/to_string_spec.rb
require 'spec_helper' describe Coercer::FalseClass, '.to_string' do subject { object.to_string(false_class) } let(:object) { described_class.new } let(:false_class) { false } it { is_expected.to be_instance_of(String) } it { is_expected.to eql('false') } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/time_coercions/to_datetime_spec.rb
spec/unit/coercible/coercer/time_coercions/to_datetime_spec.rb
require 'spec_helper' describe Coercer::TimeCoercions, '.to_datetime' do subject { object.to_datetime(value) } let(:object) { coercer.new } let(:coercer) { Class.new(Coercer::Object) { include Coercer::TimeCoercions } } let(:value) { double('value') } after do Coercer::Object.descendants.delete(coer...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/time_coercions/to_time_spec.rb
spec/unit/coercible/coercer/time_coercions/to_time_spec.rb
require 'spec_helper' describe Coercer::TimeCoercions, '.to_time' do subject { object.to_time(value) } let(:object) { coercer.new } let(:coercer) { Class.new(Coercer::Object) { include Coercer::TimeCoercions } } let(:value) { double('value') } after do Coercer::Object.descendants.delete(coercer) e...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/time_coercions/to_date_spec.rb
spec/unit/coercible/coercer/time_coercions/to_date_spec.rb
require 'spec_helper' describe Coercer::TimeCoercions, '.to_date' do subject { object.to_date(value) } let(:object) { coercer.new } let(:coercer) { Class.new(Coercer::Object) { include Coercer::TimeCoercions } } let(:value) { double('value') } after do Coercer::Object.descendants.delete(coercer) e...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/time_coercions/to_string_spec.rb
spec/unit/coercible/coercer/time_coercions/to_string_spec.rb
require 'spec_helper' describe Coercer::TimeCoercions, '.to_string' do subject { object.to_string(value) } let(:object) { coercer.new } let(:coercer) { Class.new(Coercer::Object) { include Coercer::TimeCoercions } } let(:value) { double('value') } after do Coercer::Object.descendants.delete(coercer)...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/time/coerced_predicate_spec.rb
spec/unit/coercible/coercer/time/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::Time, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { Time.now } let(:non_primitive_value) { 'other' } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/time/to_integer_spec.rb
spec/unit/coercible/coercer/time/to_integer_spec.rb
require 'spec_helper' describe Coercer::Time, '.to_integer' do subject { described_class.new.to_integer(value) } let(:time) { Time.now } let(:value) { time } it { is_expected.to eql(time.to_i) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/time/to_time_spec.rb
spec/unit/coercible/coercer/time/to_time_spec.rb
require 'spec_helper' describe Coercer::Time, '.to_time' do subject { object.to_time(time) } let(:object) { described_class.new } let(:time) { Time.local(2012, 1, 1) } it { is_expected.to equal(time) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/object/coerced_predicate_spec.rb
spec/unit/coercible/coercer/object/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::Object, '#coerced?' do subject { object.coerced?(value) } let(:object) { described_class.new } let(:value) { 'something' } it { is_expected.to be(true) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/object/to_integer_spec.rb
spec/unit/coercible/coercer/object/to_integer_spec.rb
require 'spec_helper' describe Coercer::Object, '.to_integer' do subject { object.to_integer(value) } let(:object) { described_class.new } let(:value) { double('value') } context 'when the value responds to #to_int' do let(:coerced) { double('coerced') } before do expect(value).to receive(:...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/object/method_missing_spec.rb
spec/unit/coercible/coercer/object/method_missing_spec.rb
require 'spec_helper' describe Coercer::Object, '#method_missing' do subject { object.send(method_name, value) } let(:object) { described_class.new } let(:value) { Object.new } context "when method matches coercion method regexp" do let(:method_name) { :to_whatever } it { is_expected.to be(value) }...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/object/to_array_spec.rb
spec/unit/coercible/coercer/object/to_array_spec.rb
require 'spec_helper' describe Coercer::Object, '.to_array' do subject { object.to_array(value) } let(:object) { described_class.new } let(:value) { Object.new } let(:coerced) { [ value ] } context 'when the value responds to #to_ary' do before do expect(value).to receive(:to_ary).a...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/object/inspect_spec.rb
spec/unit/coercible/coercer/object/inspect_spec.rb
require 'spec_helper' describe Coercer::Object, '#inspect' do subject { object.inspect } let(:object) { described_class.new } it { is_expected.to eq('#<Coercible::Coercer::Object primitive=Object>')} end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/object/to_string_spec.rb
spec/unit/coercible/coercer/object/to_string_spec.rb
require 'spec_helper' describe Coercer::Object, '.to_string' do subject { object.to_string(value) } let(:object) { described_class.new } let(:value) { Object.new } context 'when the value responds to #to_str' do let(:coerced) { double('coerced') } before do expect(value).to receive(:to_s...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/object/to_hash_spec.rb
spec/unit/coercible/coercer/object/to_hash_spec.rb
require 'spec_helper' describe Coercer::Object, '.to_hash' do subject { object.to_hash(value) } let(:object) { described_class.new } let(:value) { double('value') } context 'when the value responds to #to_hash' do let(:coerced) { double('coerced') } before do expect(value).to receive(:to_ha...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/array/coerced_predicate_spec.rb
spec/unit/coercible/coercer/array/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::Array, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { [ 1, 2, 3 ] } let(:non_primitive_value) { 'other' } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/array/to_set_spec.rb
spec/unit/coercible/coercer/array/to_set_spec.rb
require 'spec_helper' describe Coercer::Array, '#to_set' do subject { object.to_set(array) } let(:object) { described_class.new } let(:array) { [ 'a', 1, 'b', 2, 'b', 1, 'a', 2 ] } it { is_expected.to be_instance_of(Set) } it { is_expected.to eql(Set[ 'a', 1, 'b', 2 ]) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/decimal/coerced_predicate_spec.rb
spec/unit/coercible/coercer/decimal/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::Decimal, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { BigDecimal('1.2') } let(:non_primitive_value) { 'other' } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/decimal/to_integer_spec.rb
spec/unit/coercible/coercer/decimal/to_integer_spec.rb
require 'spec_helper' describe Coercer::Decimal, '.to_integer' do subject { object.to_integer(big_decimal) } let(:object) { described_class.new } let(:big_decimal) { BigDecimal('1.0') } it { is_expected.to be_kind_of(Integer) } it { is_expected.to eql(1) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/decimal/to_decimal_spec.rb
spec/unit/coercible/coercer/decimal/to_decimal_spec.rb
require 'spec_helper' describe Coercer::Decimal, '.to_decimal' do subject { described_class.new.to_decimal(value) } let(:value) { BigDecimal('1.0') } it { is_expected.to be(value) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/decimal/to_string_spec.rb
spec/unit/coercible/coercer/decimal/to_string_spec.rb
require 'spec_helper' describe Coercer::Decimal, '.to_string' do subject { object.to_string(big_decimal) } let(:object) { described_class.new } let(:big_decimal) { BigDecimal('1.0') } it { is_expected.to be_instance_of(String) } it { is_expected.to eql('1.0') } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/decimal/to_float_spec.rb
spec/unit/coercible/coercer/decimal/to_float_spec.rb
require 'spec_helper' describe Coercer::Decimal, '.to_float' do subject { object.to_float(big_decimal) } let(:object) { described_class.new } let(:big_decimal) { BigDecimal('1.0') } it { is_expected.to be_instance_of(Float) } it { is_expected.to eql(1.0) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/date_time/coerced_predicate_spec.rb
spec/unit/coercible/coercer/date_time/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::DateTime, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { DateTime.new } let(:non_primitive_value) { 'other' } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/date_time/to_datetime_spec.rb
spec/unit/coercible/coercer/date_time/to_datetime_spec.rb
require 'spec_helper' describe Coercer::DateTime, '.to_datetime' do subject { object.to_datetime(date_time) } let(:object) { described_class.new } let(:date_time) { DateTime.new(2012, 1, 1) } it { is_expected.to equal(date_time) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/date_time/to_time_spec.rb
spec/unit/coercible/coercer/date_time/to_time_spec.rb
require 'spec_helper' describe Coercer::DateTime, '.to_time' do subject { object.to_time(date_time) } let(:object) { described_class.new } let(:date_time) { DateTime.new(2011, 1, 1) } context 'when DateTime does not support #to_time' do if RUBY_VERSION < '1.9' before do expect(d...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/date_time/to_date_spec.rb
spec/unit/coercible/coercer/date_time/to_date_spec.rb
require 'spec_helper' describe Coercer::DateTime, '.to_date' do subject { object.to_date(date_time) } let(:object) { described_class.new } let(:date_time) { DateTime.new(2011, 1, 1) } context 'when DateTime does not support #to_date' do if RUBY_VERSION < '1.9' before do expect(d...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/date_time/to_string_spec.rb
spec/unit/coercible/coercer/date_time/to_string_spec.rb
require 'spec_helper' describe Coercer::DateTime, '.to_string' do subject { object.to_string(date_time) } let(:object) { described_class.new } let(:date_time) { DateTime.new(2011, 1, 1, 0, 0, 0, 0) } it { is_expected.to be_instance_of(String) } it { is_expected.to eql('2011-01-01T00:00:00+00:00') } end...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/numeric/to_integer_spec.rb
spec/unit/coercible/coercer/numeric/to_integer_spec.rb
require 'spec_helper' describe Coercer::Numeric, '.to_integer' do subject { object.to_integer(numeric) } let(:object) { described_class.new } let(:numeric) { Rational(2, 2) } it { is_expected.to eql(1) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/numeric/to_decimal_spec.rb
spec/unit/coercible/coercer/numeric/to_decimal_spec.rb
require 'spec_helper' describe Coercer::Numeric, '.to_decimal' do subject { object.to_decimal(value) } let(:object) { described_class.new } context "with an object responding to #to_d" do let(:value) { Rational(2, 2) } it { is_expected.to eql(BigDecimal('1.0')) } end context "with an object not...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/numeric/to_string_spec.rb
spec/unit/coercible/coercer/numeric/to_string_spec.rb
require 'spec_helper' describe Coercer::Numeric, '.to_string' do subject { object.to_string(numeric) } let(:object) { described_class.new } let(:numeric) { Rational(2, 2) } let(:coerced_value) { RUBY_VERSION < '1.9' ? '1' : '1/1' } it { is_expected.to eql(coerced_value) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/numeric/to_float_spec.rb
spec/unit/coercible/coercer/numeric/to_float_spec.rb
require 'spec_helper' describe Coercer::Numeric, '.to_float' do subject { object.to_float(numeric) } let(:object) { described_class.new } let(:numeric) { Rational(2, 2) } it { is_expected.to eql(1.0) } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/symbol/coerced_predicate_spec.rb
spec/unit/coercible/coercer/symbol/coerced_predicate_spec.rb
require 'spec_helper' describe Coercer::Symbol, '#coerced?' do let(:object) { described_class.new } it_behaves_like 'Coercible::Coercer#coerced?' do let(:primitive_value) { :symbol } let(:non_primitive_value) { 'other' } end end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/unit/coercible/coercer/symbol/to_string_spec.rb
spec/unit/coercible/coercer/symbol/to_string_spec.rb
require 'spec_helper' describe Coercer::Symbol, '.to_string' do subject { object.to_string(symbol) } let(:object) { described_class.new } let(:symbol) { :piotr } it { is_expected.to be_instance_of(String) } it { is_expected.to eql('piotr') } end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/shared/unit/coerced_predicate.rb
spec/shared/unit/coerced_predicate.rb
shared_examples_for 'Coercible::Coercer#coerced?' do context "with a primitive value" do subject { object.coerced?(primitive_value) } it { is_expected.to be(true) } end context "with a non-primitive value" do subject { object.coerced?(non_primitive_value) } it { is_expected.to be(false) } end...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/spec/shared/unit/configurable.rb
spec/shared/unit/configurable.rb
shared_examples_for 'Configurable' do describe '.config_name' do subject { described_class.config_name } it { is_expected.to be_instance_of(Symbol) } end describe '.config_keys' do subject { described_class.config_keys } it { is_expected.to be_instance_of(Array) } it { is_expected.not_to be...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible.rb
lib/coercible.rb
module Coercible EXTRA_CONST_ARGS = (RUBY_VERSION < '1.9' ? [] : [ false ]).freeze UnsupportedCoercion = Class.new(StandardError) # Test for rubinius platform # # @return [true] # if running under rubinius # # @return [false] # otherwise # # @api private def self.rbx? @is_rbx ||= defin...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/version.rb
lib/coercible/version.rb
module Coercible VERSION = "1.0.1" end
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/configuration.rb
lib/coercible/configuration.rb
module Coercible # Configuration object for global and per coercer type settings # class Configuration # Build a configuration instance # # @param [Array] list of accessor keys # # @return [Configuration] # # @api private def self.build(keys, &block) config = new keys...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer.rb
lib/coercible/coercer.rb
module Coercible # Coercer object # # # @example # # coercer = Coercible::Coercer.new # # coercer[String].to_boolean('yes') # => true # coercer[Integer].to_string(1) # => '1' # # @api public class Coercer # Return coercer instances # # @return [Array<Coercer::Object>] ...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/true_class.rb
lib/coercible/coercer/true_class.rb
module Coercible class Coercer # Coerce true values class TrueClass < Object primitive ::TrueClass # Coerce given value to String # # @example # coercer[TrueClass].to_string(true) # => "true" # # @param [TrueClass] 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/decimal.rb
lib/coercible/coercer/decimal.rb
module Coercible class Coercer # Coerce BigDecimal values class Decimal < Numeric primitive ::BigDecimal FLOAT_FORMAT = 'F'.freeze # Coerce given value to String # # @example # coercer[BigDecimal].to_string(BigDecimal('1.0')) # => "1.0" # # @param [BigDecim...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false
solnic/coercible
https://github.com/solnic/coercible/blob/c076869838531abb5783280da108aa3cbddbd61a/lib/coercible/coercer/array.rb
lib/coercible/coercer/array.rb
module Coercible class Coercer # Coerce Array values class Array < Object primitive ::Array TIME_SEGMENTS = [ :year, :month, :day, :hour, :min, :sec ].freeze # Creates a Set instance from an Array # # @param [Array] value # # @return [Array] # # @api pr...
ruby
MIT
c076869838531abb5783280da108aa3cbddbd61a
2026-01-04T17:44:40.075543Z
false