Module: Stupidedi::Versions::Common::ElementTypes::Operators::Unary

Included in:
DateVal::Proper, FixnumVal::NonEmpty, FloatVal::NonEmpty, IdentifierVal::Valid, StringVal::Valid
Defined in:
lib/stupidedi/versions/common/element_types/operators.rb

Instance Method Summary collapse

Instance Method Details

#unary_operators(*ops)


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/stupidedi/versions/common/element_types/operators.rb', line 10

def unary_operators(*ops)
  file, line, = Stupidedi.caller

  ops.each do |op|
    class_eval(<<-RUBY, file, line.to_i - 1)
      def #{op}(&block)
        copy(:value => value.#{op}(&block))
      end
    RUBY
  end
end