class Ijson::Command::ChangeDir
Attributes
current_path[RW]
root[RW]
Public Class Methods
new(env, paths, options={})
click to toggle source
# File lib/ijson/command.rb, line 39 def initialize(env, paths, options={}) @env = env @root = options[:root] @paths = paths end
Public Instance Methods
absolute_path()
click to toggle source
# File lib/ijson/command.rb, line 69 def absolute_path @root ? @paths : Array(klass.current_path) + @paths end
is_root?()
click to toggle source
# File lib/ijson/command.rb, line 45 def is_root? @root end
klass()
click to toggle source
# File lib/ijson/command.rb, line 35 def klass self.class end
new_env()
click to toggle source
# File lib/ijson/command.rb, line 57 def new_env root = @root ? klass.root : @env @paths.inject(root) {|acc, path| case acc[path] when Hash, Array acc[path] else false end } end
run()
click to toggle source
# File lib/ijson/command.rb, line 49 def run env = new_env return "invalid path #{@paths}" unless env klass.current_path = absolute_path Command.use_binding_of env end