Class: HeadMusic::Style::Annotation::Configured
- Inherits:
-
Object
- Object
- HeadMusic::Style::Annotation::Configured
- Defined in:
- lib/head_music/style/annotation/configured.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.
7 8 9 10 |
# File 'lib/head_music/style/annotation/configured.rb', line 7 def initialize(guideline_class, ) @guideline_class = guideline_class @options = end |
Instance Attribute Details
#guideline_class ⇒ Object (readonly)
Returns the value of attribute guideline_class.
5 6 7 |
# File 'lib/head_music/style/annotation/configured.rb', line 5 def guideline_class @guideline_class end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/head_music/style/annotation/configured.rb', line 5 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.
25 26 27 |
# File 'lib/head_music/style/annotation/configured.rb', line 25 def default_gate? .fetch(:gate, guideline_class.default_gate?) end |
#name ⇒ Object Also known as: to_s, inspect
29 30 31 |
# File 'lib/head_music/style/annotation/configured.rb', line 29 def name guideline_class.name end |
#new(voice) ⇒ Object
12 13 14 |
# File 'lib/head_music/style/annotation/configured.rb', line 12 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.
18 19 20 |
# File 'lib/head_music/style/annotation/configured.rb', line 18 def with(**more) Configured.new(guideline_class, .merge(more)) end |