lib/apia/enum.rb
# Cast a value or define a new block for casting (for DSL purposes)
#
# @param value [Object?]
# @return [Object?]
Cast a value or define a new block for casting (for DSL purposes)
Cast a value or define a new block for casting ( for DSL purposes )
def cast(value = nil, &block)
        if block_given? && value.nil?
          return definition.dsl.cast(&block)
        end
        value = definition.cast.call(value) if definition.cast
        if definition.values[value].nil?
          raise InvalidEnumOptionError.new(self, value)
        end
        value
      end
def cast ( value = nil , & block ) if block_given? && value . nil? return definition . dsl . cast ( & block ) end value = definition . cast . call ( value ) if definition . cast if definition . values [ value ] . nil? raise InvalidEnumOptionError . new ( self , value ) end value end
Cast a value or define a new block for casting (for DSL purposes)
Cast a value or define a new block for casting ( for DSL purposes )
None
Object?
value
<not_specific>
block
<not_specific>
<not_specific>
None