Class: ModraUp::OptionsProvider
- Inherits:
-
Object
- Object
- ModraUp::OptionsProvider
- Includes:
- Enumerable
Overview
A set of name/value options retrieved from ModraUp::Model#options.
- "PageOptions": ShowTransition (Boolean, whether to enable scene transition), TransitionTime (seconds). - "SlideshowOptions": LoopSlideshow (Boolean, play from the beginning after the last slide), SlideTime (seconds per slide). - "UnitsOptions": LengthUnit / LengthPrecision read/write the core unit, LengthFormat fixed to Length::Decimal.
When a scene's ModraUp::Page#transition_time / ModraUp::Page#delay_time is negative, the seconds from the first two groups are used.
Instance Method Summary # collapse
-
#[] ⇒ Object, nil
Return the value by key name or index. Unknown keys return nil.
-
#[]= ⇒ Object, false
Write the option. Returns the written value if successful, returns false for unsupported keys or values like feet or yards.
-
#name ⇒ String
Provider Name.
-
#keys ⇒ Array<String>
All key names.
-
#size ⇒ Integer
Number of keys.
-
#key?(name) ⇒ Boolean
Returns whether the given key exists.
-
#each ⇒ nil, Enumerator
Iterate through all options.
-
#each_key ⇒ nil, Enumerator
Iterate through the key names.
-
#each_value ⇒ nil, Enumerator
Iterate through values.
-
#add_observer(observer) ⇒ Boolean
Add a ModraUp::OptionsProviderObserver. Dispatches when LengthUnit / LengthPrecision or animation options are changed via #[]=.
-
#remove_observer(observer) ⇒ Boolean
Remove observer.
Instance Method Details
provider[name] ⇒ Object, nilprovider[index] ⇒ Object, nil
Return the value by key name or index. Unknown keys return nil.
provider[key] = value ⇒ value, false
Write the option. Returns the written value if successful, returns false for unsupported keys or values like feet or yards.
Unit options take an Integer; animation switch takes a Boolean, and seconds take a non-negative number.
provider.name ⇒ String
Provider Name.
provider.keys ⇒ Array<String>
All key names.
provider.size ⇒ Integer
Number of keys.
provider.key?(name) ⇒ Boolean
Returns whether the given key exists.
provider.each {|key, value| ... } ⇒ nilprovider.each ⇒ Enumerator
Iterate through all options.
provider.each_key {|key| ... } ⇒ nilprovider.each_key ⇒ Enumerator
Iterate through the key names.
provider.each_value {|value| ... } ⇒ nilprovider.each_value ⇒ Enumerator
Iterate through values.
provider.add_observer(observer) ⇒ Boolean
Add a ModraUp::OptionsProviderObserver. Dispatches when LengthUnit / LengthPrecision or animation options are changed via #[]=.
provider.remove_observer(observer) ⇒ Boolean
Remove observer.