Class: Copland::Implementation::SymbolSource
- Inherits:
-
Object
- Object
- Copland::Implementation::SymbolSource
- 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
-
#defaults ⇒ Object
The map configuration point that backs this service.
Instance Method Summary collapse
-
#[](name) ⇒ Object
A convenience method that just delegates to #lookup.
-
#has_symbol?(name) ⇒ Boolean
Returns
true
if the source contains a symbol with the given name. -
#lookup(name, default = nil) ⇒ Object
Returns the value of the given symbol, or the value of
default
if no such symbol exists in source.
Instance Attribute Details
#defaults ⇒ Object
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.
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 |