Class: Datory::Attributes::Options::To
- Defined in:
- lib/datory/attributes/options/to.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#include_class ⇒ Object
readonly
Returns the value of attribute include_class.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize(name:, type:, required:, default:, consists_of:, min:, max:, format:, include_class:) ⇒ To
constructor
A new instance of To.
Methods included from DSL
Methods included from Context::DSL
Methods included from Info::DSL
Constructor Details
#initialize(name:, type:, required:, default:, consists_of:, min:, max:, format:, include_class:) ⇒ To
Returns a new instance of To.
9 10 11 12 13 14 15 16 17 |
# File 'lib/datory/attributes/options/to.rb', line 9 def initialize(name:, type:, required:, default:, consists_of:, min:, max:, format:, include_class:) @required = required @default = default @include_class = include_class format = format.fetch(:to, nil) if format.is_a?(Hash) super(name:, type:, consists_of:, min:, max:, format:) end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
7 8 9 |
# File 'lib/datory/attributes/options/to.rb', line 7 def default @default end |
#include_class ⇒ Object (readonly)
Returns the value of attribute include_class.
7 8 9 |
# File 'lib/datory/attributes/options/to.rb', line 7 def include_class @include_class end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
7 8 9 |
# File 'lib/datory/attributes/options/to.rb', line 7 def required @required end |
Instance Method Details
#info ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/datory/attributes/options/to.rb', line 19 def info super.merge( required:, default:, include: include_class ) end |