Module: PathCommon
- Included in:
- Command, Configuration
- Defined in:
- lib/common.rb
Constant Summary collapse
- PROJECT_DIR =
"#{File.dirname(__FILE__)}/../"- CONFIG_FILE =
"#{PROJECT_DIR}etc/templates_path.conf"
Instance Method Summary collapse
- #absolute_path(path, dir = Dir.pwd) ⇒ Object
- #get_path ⇒ Object
- #join(path, file = ".") ⇒ Object
- #parse_string(string) ⇒ Object
Instance Method Details
#absolute_path(path, dir = Dir.pwd) ⇒ Object
7 8 9 |
# File 'lib/common.rb', line 7 def absolute_path(path,dir=Dir.pwd) Pathname.new(path).relative? ? File.(path,dir) : path end |
#get_path ⇒ Object
13 14 15 16 17 |
# File 'lib/common.rb', line 13 def get_path File.open(CONFIG_FILE).readlines.collect do |path| path = absolute_path(path.chomp,File.dirname(__FILE__)) end end |
#join(path, file = ".") ⇒ Object
18 19 20 |
# File 'lib/common.rb', line 18 def join(path,file=".") File.join(path,file) end |
#parse_string(string) ⇒ Object
10 11 12 |
# File 'lib/common.rb', line 10 def parse_string(string) string.split(';').collect { |classes| classes.split(',') } end |