Module: Avm::Instances::Entries
- Included in:
- Application, Base
- Defined in:
- lib/avm/instances/entries.rb
Instance Method Summary collapse
- #entry(suffix, options = {}) ⇒ Object
- #full_entry_path(entry_suffix) ⇒ Object
- #inherited_entry_value(source_entry_suffix, target_entry_suffix, &block) ⇒ Object
- #other_entry_value(instance_id, entry_suffix) ⇒ Object
- #path_prefix ⇒ Object
- #read_entry(entry_suffix, options = {}) ⇒ Object
- #read_entry_optional(entry_suffix, options = {}) ⇒ Object
Instance Method Details
#entry(suffix, options = {}) ⇒ Object
9 10 11 |
# File 'lib/avm/instances/entries.rb', line 9 def entry(suffix, = {}) ::Avm::Instances::Entry.new(self, suffix, ) end |
#full_entry_path(entry_suffix) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/avm/instances/entries.rb', line 25 def full_entry_path(entry_suffix) unless entry_suffix.is_a?(::Array) entry_suffix = ::EacConfig::PathsHash.parse_entry_key(entry_suffix.to_s) end (path_prefix + entry_suffix).join('.') end |
#inherited_entry_value(source_entry_suffix, target_entry_suffix, &block) ⇒ Object
32 33 34 35 36 |
# File 'lib/avm/instances/entries.rb', line 32 def inherited_entry_value(source_entry_suffix, target_entry_suffix, &block) read_entry_optional(source_entry_suffix).if_present do |instance_id| other_entry_value(instance_id, target_entry_suffix).if_present(&block) end end |
#other_entry_value(instance_id, entry_suffix) ⇒ Object
38 39 40 |
# File 'lib/avm/instances/entries.rb', line 38 def other_entry_value(instance_id, entry_suffix) ::Avm::Instances::Base.by_id(instance_id).read_entry_optional(entry_suffix) end |
#path_prefix ⇒ Object
13 14 15 |
# File 'lib/avm/instances/entries.rb', line 13 def path_prefix @path_prefix ||= [id].freeze end |
#read_entry(entry_suffix, options = {}) ⇒ Object
17 18 19 |
# File 'lib/avm/instances/entries.rb', line 17 def read_entry(entry_suffix, = {}) entry(entry_suffix, ).value end |
#read_entry_optional(entry_suffix, options = {}) ⇒ Object
21 22 23 |
# File 'lib/avm/instances/entries.rb', line 21 def read_entry_optional(entry_suffix, = {}) entry(entry_suffix, ).optional_value end |