Class: Stronger::Property
- Inherits:
-
Object
- Object
- Stronger::Property
- Defined in:
- lib/stronger/property.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, type:, required: true) ⇒ Property
constructor
A new instance of Property.
- #required? ⇒ Boolean
- #typed? ⇒ Boolean
Constructor Details
#initialize(name, type:, required: true) ⇒ Property
Returns a new instance of Property.
4 5 6 |
# File 'lib/stronger/property.rb', line 4 def initialize(name, type:, required: true) @name, @type, @required = name, type, required end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/stronger/property.rb', line 3 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/stronger/property.rb', line 3 def type @type end |
Instance Method Details
#required? ⇒ Boolean
8 9 10 |
# File 'lib/stronger/property.rb', line 8 def required? !!required end |
#typed? ⇒ Boolean
12 13 14 |
# File 'lib/stronger/property.rb', line 12 def typed? !type.nil? end |