Class: Compendium::Param

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/compendium/param_types.rb

Direct Known Subclasses

BooleanParam, DateParam, ParamWithChoices, ScalarParam

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



12
13
14
15
# File 'lib/compendium/param_types.rb', line 12

def ==(other)
  return true if (value == other rescue false)
  super
end

#boolean?Boolean

Returns:

  • (Boolean)


7
# File 'lib/compendium/param_types.rb', line 7

def boolean?; false; end

#date?Boolean

Returns:

  • (Boolean)


8
# File 'lib/compendium/param_types.rb', line 8

def date?; false; end

Returns:

  • (Boolean)


9
# File 'lib/compendium/param_types.rb', line 9

def dropdown?; false; end

#nil?Boolean

Need to explicitly delegate nil? to the object, otherwise it’s always false This is because SimpleDelegator is a non-nil object, and it only forwards non-defined methods!

Returns:

  • (Boolean)


19
20
21
# File 'lib/compendium/param_types.rb', line 19

def nil?
  __getobj__.nil?
end

#radio?Boolean

Returns:

  • (Boolean)


10
# File 'lib/compendium/param_types.rb', line 10

def radio?; false; end

#scalar?Boolean

Returns:

  • (Boolean)


6
# File 'lib/compendium/param_types.rb', line 6

def scalar?; false; end

#to_fObject



23
24
25
# File 'lib/compendium/param_types.rb', line 23

def to_f
  Kernel.Float(__getobj__)
end

#to_iObject



27
28
29
# File 'lib/compendium/param_types.rb', line 27

def to_i
  Kernel.Integer(__getobj__)
end