Class: LedgerSync::Type::StringFromSet
- Defined in:
- lib/ledger_sync/type/string_from_set.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #assert_valid(args = {}) ⇒ Object
-
#initialize(args = {}) ⇒ StringFromSet
constructor
A new instance of StringFromSet.
- #type ⇒ Object
- #valid?(args = {}) ⇒ Boolean
Methods inherited from String
Methods included from ValueMixin
Constructor Details
#initialize(args = {}) ⇒ StringFromSet
Returns a new instance of StringFromSet.
10 11 12 13 14 |
# File 'lib/ledger_sync/type/string_from_set.rb', line 10 def initialize(args = {}) @values = args.fetch(:values) super(**args.except(:values)) end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
8 9 10 |
# File 'lib/ledger_sync/type/string_from_set.rb', line 8 def values @values end |
Instance Method Details
#assert_valid(args = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/ledger_sync/type/string_from_set.rb', line 16 def assert_valid(args = {}) return if valid_value?(args) raise Error::TypeError::StringFromSetError.new( expected: @values, given: args.fetch(:value) ) end |
#type ⇒ Object
29 30 31 |
# File 'lib/ledger_sync/type/string_from_set.rb', line 29 def type :StringFromSet end |
#valid?(args = {}) ⇒ Boolean
25 26 27 |
# File 'lib/ledger_sync/type/string_from_set.rb', line 25 def valid?(args = {}) super && valid_value?(args) end |