Sha256: c2224466f2ad95d4a1a7a01b343519fc9a48981d6cf8f878b310bda1aad4ee9b

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

require 'ruby_less/safe_class'


# Dummy classes
class Boolean
end

class Number
end

class StringDictionary
  include RubyLess
  safe_method ['[]', Symbol] => {:class => String, :nil => true}
end

RubyLess::SafeClass.safe_literal_class Fixnum => Number, Float => Number, Symbol => Symbol, Regexp => Regexp, Range => Range
RubyLess::SafeClass.safe_method_for( Number,
  [:==, Number] => Boolean, [:< , Number] => Boolean, [:> , Number] => Boolean,
  [:<=, Number] => Boolean, [:>=, Number] => Boolean, [:- , Number] => Number,
  [:+ , Number] => Number,  [:* , Number] => Number,  [:/ , Number] => Number,
  [:% , Number] => Number,  [:"-@"]       => Number,
  :to_f => Number,
  :to_i => Number
)

RubyLess::SafeClass.safe_method_for( Time,
  [:==, Time] => Boolean, [:< , Time] => Boolean, [:> , Time] => Boolean,
  [:<=, Time] => Boolean, [:>=, Time] => Boolean,
  [:- , Number] => Time,  [:+ , Number] => Time
)

RubyLess::SafeClass.safe_method_for( String,
  [:==, String] => Boolean
)

RubyLess::SafeClass.safe_method_for( NilClass,
  [:==, String] => Boolean,
  [:==, Number] => Boolean,
  :to_f => Number,
  :to_i => Number
)

RubyLess::SafeClass.safe_method_for( Array,
  :size => Number
)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubyless-0.8.11 lib/ruby_less/basic_types.rb
rubyless-0.8.10 lib/ruby_less/basic_types.rb
rubyless-0.8.9 lib/ruby_less/basic_types.rb
rubyless-0.8.8 lib/ruby_less/basic_types.rb
rubyless-0.8.7 lib/ruby_less/basic_types.rb