Class: Basis::Context
- Inherits:
-
Object
- Object
- Basis::Context
- Defined in:
- lib/basis/context.rb
Instance Attribute Summary collapse
-
#my ⇒ Object
readonly
Returns the value of attribute my.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #git(key) ⇒ Object
-
#initialize(my, overrides) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(my, overrides) ⇒ Context
Returns a new instance of Context.
5 6 7 8 9 |
# File 'lib/basis/context.rb', line 5 def initialize my, overrides @git = Hash[`git config -lz`.split("\000").map { |e| e.split "\n" }] @my = my @overrides = overrides || {} end |
Instance Attribute Details
#my ⇒ Object (readonly)
Returns the value of attribute my.
3 4 5 |
# File 'lib/basis/context.rb', line 3 def my @my end |
Instance Method Details
#[](key) ⇒ Object
11 12 13 |
# File 'lib/basis/context.rb', line 11 def [] key @overrides[key] || @my.to_h[key] || @git[key] end |
#git(key) ⇒ Object
15 16 17 |
# File 'lib/basis/context.rb', line 15 def git key @git[key] end |