Sha256: 59e00c39019ceed1744814359b6d1701ca358a8870cb703c5c458ea6e7da6775

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'myrrha/with_core_ext'
require 'myrrha/coerce'
require 'myrrha/to_ruby_literal'
require 'date'
require 'shared/a_value'

unless defined?(SAFE_VALUES)
  SAFE_VALUES = {
    NilClass   => [ nil ],
    TrueClass  => [ true ],
    FalseClass => [ false ],
    Fixnum     => [ -(2**(0.size * 8 - 2)), -1, 0, 1, 10, (2**(0.size * 8 - 2) - 1)],
    Bignum     => [ -(2**(0.size * 8 - 2)) - 1, (2**(0.size * 8 - 2)) ],
    Float      => [ -0.10, 0.0, 0.10 ],
    String     => ['', 'hello'],
    Symbol     => [ :hello, :"s-b-y-c", :"12" ],
    Class      => [ Integer, ::Struct::Tms ],
    Module     => [ Kernel, Myrrha ],
    Regexp     => [ /a-z/, /^$/, /\s*/, /[a-z]{15}/ ],
    Range      => [ 0..10, 0...10 ],
    Array      => [ [], [nil], [1, "hello"] ],
    Hash       => [ {}, {1 => 2, :hello => "world"} ]
  }
  UNSAFE_VALUES = {
    Date  => [ Date.today ],
    Time  => [ Time.now   ],
    Array => [ [Date.today, Time.now] ],
    Hash  => [ {Date.today => Time.now} ],
    Range => [ Date.today..(Date.today+1) ]
  }
  VALUES = SAFE_VALUES.values.inject([], :+) + UNSAFE_VALUES.values.inject([], :+)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
myrrha-1.1.0 spec/spec_helper.rb