Class: Copland::Implementation::SymbolSource

Inherits:
Object
  • Object
show all
Defined in:
lib/copland/impl/symbol-source.rb

Overview

The default SymbolSource implementation, used by both the ApplicationDefaults and FactoryDefaults implementations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#defaultsObject

The map configuration point that backs this service.



42
43
44
# File 'lib/copland/impl/symbol-source.rb', line 42

def defaults
  @defaults
end

Instance Method Details

#[](name) ⇒ Object

A convenience method that just delegates to #lookup.



56
57
58
# File 'lib/copland/impl/symbol-source.rb', line 56

def []( name )
  lookup( name )
end

#has_symbol?(name) ⇒ Boolean

Returns true if the source contains a symbol with the given name.

Returns:

  • (Boolean)


45
46
47
# File 'lib/copland/impl/symbol-source.rb', line 45

def has_symbol?( name )
  defaults.has_key?( name )
end

#lookup(name, default = nil) ⇒ Object

Returns the value of the given symbol, or the value of default if no such symbol exists in source.



51
52
53
# File 'lib/copland/impl/symbol-source.rb', line 51

def lookup( name, default=nil )
  defaults.fetch( name, default )
end