Class: SmartEnum::Attributes::Attribute
- Inherits:
-
Object
- Object
- SmartEnum::Attributes::Attribute
- Defined in:
- lib/smart_enum/attributes.rb
Instance Attribute Summary collapse
-
#coercer ⇒ Object
readonly
Returns the value of attribute coercer.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
-
#initialize(name, types, coercer) ⇒ Attribute
constructor
A new instance of Attribute.
- #inspect ⇒ Object
Constructor Details
#initialize(name, types, coercer) ⇒ Attribute
Returns a new instance of Attribute.
132 133 134 135 136 |
# File 'lib/smart_enum/attributes.rb', line 132 def initialize(name, types, coercer) @name = name @types = types @coercer = coercer end |
Instance Attribute Details
#coercer ⇒ Object (readonly)
Returns the value of attribute coercer.
130 131 132 |
# File 'lib/smart_enum/attributes.rb', line 130 def coercer @coercer end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
130 131 132 |
# File 'lib/smart_enum/attributes.rb', line 130 def name @name end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
130 131 132 |
# File 'lib/smart_enum/attributes.rb', line 130 def types @types end |
Instance Method Details
#inspect ⇒ Object
138 139 140 141 |
# File 'lib/smart_enum/attributes.rb', line 138 def inspect type_str = types.length > 1 ? types.join("|") : types[0] "#{name}: #{type_str}" end |