Class: Inplace::Config
- Inherits:
-
Object
- Object
- Inplace::Config
- Defined in:
- lib/inplace.rb
Instance Method Summary collapse
- #expand_alias(command) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #load(file) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
507 508 509 |
# File 'lib/inplace.rb', line 507 def initialize @alias = {} end |
Instance Method Details
#expand_alias(command) ⇒ Object
524 525 526 527 528 529 530 531 532 533 534 |
# File 'lib/inplace.rb', line 524 def (command) if @alias.key?(command) new_command = @alias[command] info "expanding alias: %s: %s\n", command, new_command new_command else command end end |
#load(file) ⇒ Object
511 512 513 514 515 516 517 518 519 520 521 522 |
# File 'lib/inplace.rb', line 511 def load(file) File.open(file) { |f| f.each_line { |line| line.strip! next if /^#/ =~ line if m = line.match(/^([^\s=]+)\s*=\s*(.+)/) @alias[m[1]] = m[2] end } } end |