Class: Musa::Neumas::Decoders::Decoder
- Inherits:
-
DifferentialDecoder
- Object
- ProtoDecoder
- DifferentialDecoder
- Musa::Neumas::Decoders::Decoder
- Defined in:
- lib/musa-dsl/neumas/neuma-decoder.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#transcriptor ⇒ Object
Returns the value of attribute transcriptor.
Instance Method Summary collapse
- #apply(_action, on:) ⇒ Object
- #decode(attributes) ⇒ Object
-
#initialize(base, transcriptor: nil) ⇒ Decoder
constructor
A new instance of Decoder.
- #subcontext ⇒ Object
Methods inherited from DifferentialDecoder
Constructor Details
#initialize(base, transcriptor: nil) ⇒ Decoder
Returns a new instance of Decoder.
26 27 28 29 30 31 |
# File 'lib/musa-dsl/neumas/neuma-decoder.rb', line 26 def initialize(base, transcriptor: nil) @base = base @last = base.clone @transcriptor = transcriptor end |
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
34 35 36 |
# File 'lib/musa-dsl/neumas/neuma-decoder.rb', line 34 def base @base end |
#transcriptor ⇒ Object
Returns the value of attribute transcriptor.
33 34 35 |
# File 'lib/musa-dsl/neumas/neuma-decoder.rb', line 33 def transcriptor @transcriptor end |
Instance Method Details
#apply(_action, on:) ⇒ Object
57 58 59 |
# File 'lib/musa-dsl/neumas/neuma-decoder.rb', line 57 def apply(_action, on:) raise NotImplementedError end |
#decode(attributes) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/musa-dsl/neumas/neuma-decoder.rb', line 45 def decode(attributes) result = apply process(attributes), on: @last @last = result.clone if @transcriptor @transcriptor.transcript(result) else result end end |