Module: ClassX::AttributeMethods::ClassMethods
- Defined in:
- lib/classx/attribute.rb
Overview
:nodoc:
Defined Under Namespace
Modules: CoerceNothing, CoerceWithArray, CoerceWithHash, CoerceWithProc, DefaultWithNoProc, DefaultWithProc, TriggerArrayProc, ValidateEach, ValidateKindOf, ValidateNothing, ValidateRespondTo, ValidateWithNotProc, ValidateWithProc
Instance Method Summary collapse
-
#desc ⇒ Object
description for attribute.
- #inspect ⇒ Object
-
#lazy? ⇒ Boolean
when it lazy option specified, it will not be initialized when #initialize.
-
#optional? ⇒ Boolean
when this option specify true, not raise error in #initialize without value.
- #value_class ⇒ Object
Instance Method Details
#desc ⇒ Object
description for attribute
9 10 11 |
# File 'lib/classx/attribute.rb', line 9 def desc config[:desc] end |
#inspect ⇒ Object
23 24 25 |
# File 'lib/classx/attribute.rb', line 23 def inspect "ClassX::Attribute[#{self.config.inspect}]" end |
#lazy? ⇒ Boolean
when it lazy option specified, it will not be initialized when #initialize.
19 20 21 |
# File 'lib/classx/attribute.rb', line 19 def lazy? return config[:lazy] end |
#optional? ⇒ Boolean
when this option specify true, not raise error in #initialize without value.
14 15 16 |
# File 'lib/classx/attribute.rb', line 14 def optional? return config[:optional] end |
#value_class ⇒ Object
4 5 6 |
# File 'lib/classx/attribute.rb', line 4 def value_class config[:isa] || config[:kind_of] end |