Class: Playbook::Props::Enum
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Attributes inherited from Base
#default, #deprecated, #kit, #name, #required
Instance Method Summary collapse
-
#initialize(values:, **options) ⇒ Enum
constructor
A new instance of Enum.
- #validate(value) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(values:, **options) ⇒ Enum
Returns a new instance of Enum.
8 9 10 11 |
# File 'lib/playbook/props/enum.rb', line 8 def initialize(values:, **) super(**) @values = values end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
6 7 8 |
# File 'lib/playbook/props/enum.rb', line 6 def values @values end |
Instance Method Details
#validate(value) ⇒ Object
13 14 15 |
# File 'lib/playbook/props/enum.rb', line 13 def validate(value) @values.include?(value) end |