Class: Avm::Entries::AutoValues::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/avm/entries/auto_values/entry.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries_provider, path) ⇒ Object

Parameters:

  • entries_provider
  • path (EacConfig::EntryPath)


21
22
23
# File 'lib/avm/entries/auto_values/entry.rb', line 21

common_constructor :entries_provider, :path do
  self.path = ::EacConfig::EntryPath.assert(path)
end

Class Method Details

.auto_value_method_name(path) ⇒ Object

Returns String.

Parameters:

  • path (EacConfig::EntryPath)

Returns:

  • String



13
14
15
# File 'lib/avm/entries/auto_values/entry.rb', line 13

def auto_value_method_name(path)
  "auto_#{::EacConfig::EntryPath.assert(path).to_string.gsub('.', '_')}"
end

Instance Method Details

#auto_value_methodObject



25
26
27
# File 'lib/avm/entries/auto_values/entry.rb', line 25

def auto_value_method
  self.class.auto_value_method_name(path)
end

#found?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/avm/entries/auto_values/entry.rb', line 29

def found?
  entries_provider.respond_to?(auto_value_method, true)
end

#valueObject



33
34
35
# File 'lib/avm/entries/auto_values/entry.rb', line 33

def value
  entries_provider.if_respond(auto_value_method)
end