Module: Ijson::Command

Included in:
Array, Hash
Defined in:
lib/ijson/command.rb

Defined Under Namespace

Modules: Array, Hash Classes: ChangeDir

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
# File 'lib/ijson/command.rb', line 3

def self.included(base)
  base.send(:include, Hash) if base == ::Hash
  base.send(:include, Array) if base == ::Array
end

.root=(value) ⇒ Object



12
13
14
15
# File 'lib/ijson/command.rb', line 12

def self.root=(value)
  use_binding_of value
  ChangeDir.root = value
end

.use_binding_of(env) ⇒ Object



8
9
10
# File 'lib/ijson/command.rb', line 8

def self.use_binding_of env
  Ripl.shell.binding = env.instance_eval { binding }
end

Instance Method Details

#cat(*paths) ⇒ Object



88
89
90
# File 'lib/ijson/command.rb', line 88

def cat *paths
  paths.inject(self) {|a, e| a[e]}
end

#cd(*paths) ⇒ Object



76
77
78
# File 'lib/ijson/command.rb', line 76

def cd *paths
  ChangeDir.new(self, paths).run
end

#cd!(*paths) ⇒ Object



80
81
82
# File 'lib/ijson/command.rb', line 80

def cd! *paths
  ChangeDir.new(self, paths, :root => true).run
end

#pwdObject



84
85
86
# File 'lib/ijson/command.rb', line 84

def pwd
  ChangeDir.current_path.map {|i| "[#{i}]" }.join
end