Class: AbstractCommand::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/abstract_command.rb

Overview

before ruby 1.9.1 the format method does not support the syntax we want, so we have a simplified version of format for older versions of ruby. its placed in the AbstractCommand class because we want to avoid possible collisions for people requiring our code. It can live on a better place though..

Constant Summary collapse

REGEXP =
/(%<)(\S+)(>\w)/

Class Method Summary collapse

Class Method Details

.format(template, params) ⇒ Object



35
36
37
38
39
# File 'lib/abstract_command.rb', line 35

def self.format(template, params)
  template.gsub(REGEXP) do
    params[$2.to_sym]
  end
end