Class: Infold::Decorator
- Inherits:
-
Object
- Object
- Infold::Decorator
- Includes:
- ActiveModel::Model
- Defined in:
- lib/infold/property/decorator.rb
Instance Attribute Summary collapse
-
#append ⇒ Object
Returns the value of attribute append.
-
#digit ⇒ Object
Returns the value of attribute digit.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
- #kind ⇒ Object
-
#prepend ⇒ Object
Returns the value of attribute prepend.
Instance Method Summary collapse
-
#initialize(field, **attrs) ⇒ Decorator
constructor
A new instance of Decorator.
Constructor Details
#initialize(field, **attrs) ⇒ Decorator
Returns a new instance of Decorator.
11 12 13 14 |
# File 'lib/infold/property/decorator.rb', line 11 def initialize(field, **attrs) @field = field super(**attrs) end |
Instance Attribute Details
#append ⇒ Object
Returns the value of attribute append.
7 8 9 |
# File 'lib/infold/property/decorator.rb', line 7 def append @append end |
#digit ⇒ Object
Returns the value of attribute digit.
7 8 9 |
# File 'lib/infold/property/decorator.rb', line 7 def digit @digit end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
5 6 7 |
# File 'lib/infold/property/decorator.rb', line 5 def field @field end |
#kind ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/infold/property/decorator.rb', line 16 def kind if @kind.blank? if field.number? :number elsif %i(date datetime boolean).include?(field.type) field.type else :string end else @kind.to_sym end end |
#prepend ⇒ Object
Returns the value of attribute prepend.
7 8 9 |
# File 'lib/infold/property/decorator.rb', line 7 def prepend @prepend end |