class Archive::Tar::Minitar::Command::CommandPattern
Attributes
default[RW]
Public Class Methods
<<(command)
click to toggle source
# File lib/archive/tar/minitar/command.rb 249 def <<(command) 250 add(command) 251 end
[](cmd)
click to toggle source
# File lib/archive/tar/minitar/command.rb 278 def [](cmd) 279 self.command(cmd) 280 end
add(command)
click to toggle source
# File lib/archive/tar/minitar/command.rb 232 def add(command) 233 command = command.new if command.kind_of?(Class) 234 235 @commands ||= {} 236 if @commands.has_key?(command.name) 237 raise CommandAlreadyExists 238 else 239 @commands[command.name] = command 240 end 241 242 if command.respond_to?(:altname) 243 unless @commands.has_key?(command.altname) 244 @commands[command.altname] = command 245 end 246 end 247 end
command(command)
click to toggle source
# File lib/archive/tar/minitar/command.rb 270 def command(command) 271 if command?(command) 272 @commands[command] 273 else 274 @default 275 end 276 end
command?(command)
click to toggle source
# File lib/archive/tar/minitar/command.rb 266 def command?(command) 267 @commands.has_key?(command) 268 end
default_ioe(ioe = {})
click to toggle source
# File lib/archive/tar/minitar/command.rb 282 def default_ioe(ioe = {}) 283 ioe[:input] ||= $stdin 284 ioe[:output] ||= $stdout 285 ioe[:error] ||= $stderr 286 ioe 287 end
Public Instance Methods
[](args, opts = {}, ioe = {})
click to toggle source
# File lib/archive/tar/minitar/command.rb 290 def [](args, opts = {}, ioe = {}) 291 call(args, opts, ioe) 292 end
call(args, opts = {}, ioe = {})
click to toggle source
# File lib/archive/tar/minitar/command.rb 298 def call(args, opts = {}, ioe = {}) 299 raise AbstractCommandError 300 end
help()
click to toggle source
# File lib/archive/tar/minitar/command.rb 302 def help 303 raise AbstractCommandError 304 end
name()
click to toggle source
# File lib/archive/tar/minitar/command.rb 294 def name 295 raise AbstractCommandError 296 end