Class: HeadMusic::Rudiment::Rest
- Inherits:
-
RhythmicElement
- Object
- Base
- RhythmicElement
- HeadMusic::Rudiment::Rest
- Includes:
- Named
- Defined in:
- lib/head_music/rudiment/rest.rb
Overview
A Rest represents a period of silence with a specific rhythmic value. It inherits from RhythmicElement and has a duration but no pitch.
Instance Attribute Summary collapse
-
#alias_name_keys ⇒ Object
included
from Named
readonly
Returns the value of attribute alias_name_keys.
-
#name_key ⇒ Object
included
from Named
readonly
Returns the value of attribute name_key.
Class Method Summary collapse
Instance Method Summary collapse
- #ensure_localized_name(name:, locale_code: Locale::DEFAULT_CODE, abbreviation: nil) ⇒ Object included from Named
- #localized_name(locale_code: Locale::DEFAULT_CODE) ⇒ Object included from Named
- #localized_name_in_default_locale ⇒ Object included from Named private
- #localized_name_in_locale_matching_language(locale) ⇒ Object included from Named private
- #localized_name_in_matching_locale(locale) ⇒ Object included from Named private
-
#localized_names ⇒ Object
included
from Named
Returns an array of LocalizedName instances that are synonymous with the name.
- #name ⇒ Object
- #name=(name) ⇒ Object included from Named
- #sounded? ⇒ Boolean
Constructor Details
This class inherits a constructor from HeadMusic::Rudiment::RhythmicElement
Instance Attribute Details
#alias_name_keys ⇒ Object (readonly) Originally defined in module Named
Returns the value of attribute alias_name_keys.
#name_key ⇒ Object (readonly) Originally defined in module Named
Returns the value of attribute name_key.
Class Method Details
.fetch_or_create(rhythmic_value) ⇒ Object (private)
21 22 23 24 25 |
# File 'lib/head_music/rudiment/rest.rb', line 21 def self.fetch_or_create(rhythmic_value) @rests ||= {} hash_key = rhythmic_value.to_s @rests[hash_key] ||= new(rhythmic_value) end |
.get(rhythmic_value) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/head_music/rudiment/rest.rb', line 12 def self.get(rhythmic_value) return rhythmic_value if rhythmic_value.is_a?(HeadMusic::Rudiment::Rest) rhythmic_value = HeadMusic::Rudiment::RhythmicValue.get(rhythmic_value) return nil unless rhythmic_value fetch_or_create(rhythmic_value) end |
Instance Method Details
#ensure_localized_name(name:, locale_code: Locale::DEFAULT_CODE, abbreviation: nil) ⇒ Object Originally defined in module Named
#localized_name(locale_code: Locale::DEFAULT_CODE) ⇒ Object Originally defined in module Named
#localized_name_in_default_locale ⇒ Object (private) Originally defined in module Named
#localized_name_in_locale_matching_language(locale) ⇒ Object (private) Originally defined in module Named
#localized_name_in_matching_locale(locale) ⇒ Object (private) Originally defined in module Named
#localized_names ⇒ Object Originally defined in module Named
Returns an array of LocalizedName instances that are synonymous with the name.
#name ⇒ Object
27 28 29 |
# File 'lib/head_music/rudiment/rest.rb', line 27 def name "#{rhythmic_value} rest" end |
#name=(name) ⇒ Object Originally defined in module Named
#sounded? ⇒ Boolean
31 32 33 |
# File 'lib/head_music/rudiment/rest.rb', line 31 def sounded? false end |