Module: Avm::Instances::Entries
- Included in:
- Application, Base
- Defined in:
- lib/avm/instances/entries.rb,
lib/avm/instances/entries/entry_reader.rb
Defined Under Namespace
Classes: EntryReader
Instance Method Summary collapse
- #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
#full_entry_path(entry_suffix) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/avm/instances/entries.rb', line 23 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
30 31 32 33 34 |
# File 'lib/avm/instances/entries.rb', line 30 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
36 37 38 |
# File 'lib/avm/instances/entries.rb', line 36 def other_entry_value(instance_id, entry_suffix) ::Avm::Instances::Base.by_id(instance_id).read_entry_optional(entry_suffix) end |
#path_prefix ⇒ Object
11 12 13 |
# File 'lib/avm/instances/entries.rb', line 11 def path_prefix @path_prefix ||= [id].freeze end |
#read_entry(entry_suffix, options = {}) ⇒ Object
15 16 17 |
# File 'lib/avm/instances/entries.rb', line 15 def read_entry(entry_suffix, = {}) entry(entry_suffix, ).value end |
#read_entry_optional(entry_suffix, options = {}) ⇒ Object
19 20 21 |
# File 'lib/avm/instances/entries.rb', line 19 def read_entry_optional(entry_suffix, = {}) entry(entry_suffix, ).optional_value end |