Class: Ablerc::Context
- Inherits:
-
Object
- Object
- Ablerc::Context
- Defined in:
- lib/ablerc/context.rb
Constant Summary collapse
- DEFAULTS =
{global: {path: '/etc/'}, user: {path: '~/'}, local: {path: './'}}
- @@contexts =
Hashie::Mash.new
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
- .<<(context) ⇒ Object
- .exists?(context) ⇒ Boolean
- .list ⇒ Object
- .method_missing(method_name, *args, &block) ⇒ Object
- .names ⇒ Object
- .paths ⇒ Object
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Context
constructor
A new instance of Context.
Constructor Details
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/ablerc/context.rb', line 10 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
10 11 12 |
# File 'lib/ablerc/context.rb', line 10 def path @path end |
Class Method Details
.<<(context) ⇒ Object
25 26 27 |
# File 'lib/ablerc/context.rb', line 25 def <<(context) @@contexts.merge!(context.name => context) end |
.exists?(context) ⇒ Boolean
44 45 46 |
# File 'lib/ablerc/context.rb', line 44 def exists?(context) @@contexts.has_key? context end |
.list ⇒ Object
35 36 37 |
# File 'lib/ablerc/context.rb', line 35 def list @@contexts end |
.method_missing(method_name, *args, &block) ⇒ Object
48 49 50 |
# File 'lib/ablerc/context.rb', line 48 def method_missing(method_name, *args, &block) @@contexts.send(method_name, *args, &block) || super end |
.names ⇒ Object
39 40 41 |
# File 'lib/ablerc/context.rb', line 39 def names @@contexts.keys end |
.paths ⇒ Object
30 31 32 |
# File 'lib/ablerc/context.rb', line 30 def paths @@contexts.collect { |name, context| context.path } end |