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
10 11 12 |
# File 'lib/avm/instances/entries.rb', line 10 def entry(suffix, = {}) ::Avm::Instances::Entry.new(self, suffix, ) end |
#full_entry_path(entry_suffix) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/avm/instances/entries.rb', line 26 def full_entry_path(entry_suffix) unless entry_suffix.is_a?(::Array) entry_suffix = ::EacRubyUtils::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
33 34 35 36 37 |
# File 'lib/avm/instances/entries.rb', line 33 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
39 40 41 |
# File 'lib/avm/instances/entries.rb', line 39 def other_entry_value(instance_id, entry_suffix) ::Avm::Instances::Base.by_id(instance_id).read_entry_optional(entry_suffix) end |
#path_prefix ⇒ Object
14 15 16 |
# File 'lib/avm/instances/entries.rb', line 14 def path_prefix @path_prefix ||= [id].freeze end |
#read_entry(entry_suffix, options = {}) ⇒ Object
18 19 20 |
# File 'lib/avm/instances/entries.rb', line 18 def read_entry(entry_suffix, = {}) entry(entry_suffix, ).value end |
#read_entry_optional(entry_suffix, options = {}) ⇒ Object
22 23 24 |
# File 'lib/avm/instances/entries.rb', line 22 def read_entry_optional(entry_suffix, = {}) entry(entry_suffix, ).optional_value end |