Module: EasyParams::Types::Struct
- Included in:
- Base
- Defined in:
- lib/easy_params/types/struct.rb
Overview
base interface for struct type
Instance Method Summary collapse
Instance Method Details
#array? ⇒ Boolean
7 8 9 |
# File 'lib/easy_params/types/struct.rb', line 7 def array? false end |
#coerce(input) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/easy_params/types/struct.rb', line 16 def coerce(input) return if input.nil? && @default.nil? return self.class.new(@default) if input.nil? && @default.is_a?(Hash) self.class.new(input) end |
#default(value) ⇒ Object
11 12 13 14 |
# File 'lib/easy_params/types/struct.rb', line 11 def default(value) self.default = value self end |