Class: HeadMusic::Style::Annotation::Configured
- Inherits:
-
Object
- Object
- HeadMusic::Style::Annotation::Configured
- Defined in:
- lib/head_music/style/annotation.rb
Overview
A RULESET entry pairing a guideline class with configuration. Quacks like a class to the analyze loop by responding to #new(voice).
Instance Attribute Summary collapse
-
#guideline_class ⇒ Object
readonly
Returns the value of attribute guideline_class.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#default_gate? ⇒ Boolean
Mirrors the class-level predicate so build-time RULESET filters can classify any entry (bare class or configured) uniformly.
-
#initialize(guideline_class, options) ⇒ Configured
constructor
A new instance of Configured.
-
#name ⇒ Object
(also: #to_s, #inspect)
-
#new(voice) ⇒ Object
-
#with(**more) ⇒ Object
Layers additional options onto an already-configured entry, e.g.
Constructor Details
#initialize(guideline_class, options) ⇒ Configured
Returns a new instance of Configured.
52 53 54 55 |
# File 'lib/head_music/style/annotation.rb', line 52 def initialize(guideline_class, ) @guideline_class = guideline_class @options = end |
Instance Attribute Details
#guideline_class ⇒ Object (readonly)
Returns the value of attribute guideline_class.
50 51 52 |
# File 'lib/head_music/style/annotation.rb', line 50 def guideline_class @guideline_class end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
50 51 52 |
# File 'lib/head_music/style/annotation.rb', line 50 def @options end |
Instance Method Details
#default_gate? ⇒ Boolean
Mirrors the class-level predicate so build-time RULESET filters can classify any entry (bare class or configured) uniformly. A per-entry gate: option takes precedence over the guideline class’s default.
70 71 72 |
# File 'lib/head_music/style/annotation.rb', line 70 def default_gate? .fetch(:gate, guideline_class.default_gate?) end |
#name ⇒ Object Also known as: to_s, inspect
74 75 76 |
# File 'lib/head_music/style/annotation.rb', line 74 def name guideline_class.name end |
#new(voice) ⇒ Object
57 58 59 |
# File 'lib/head_music/style/annotation.rb', line 57 def new(voice) guideline_class.new(voice, **) end |
#with(**more) ⇒ Object
Layers additional options onto an already-configured entry, e.g. MinimumNotes.with(5).with(gate: true), without dropping prior options.
63 64 65 |
# File 'lib/head_music/style/annotation.rb', line 63 def with(**more) Configured.new(guideline_class, .merge(more)) end |