Class: Command

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

Direct Known Subclasses

CreateCommand, MoveCommand, RemoveCommand

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject

Returns the value of attribute path.



2
3
4
# File 'lib/commands.rb', line 2

def path
  @path
end

Instance Method Details

#<=>(other) ⇒ Object



26
27
28
# File 'lib/commands.rb', line 26

def <=> other
  priority <=> other.priority
end

#dry_runObject

Raises:

  • (NotImplementedError)


23
# File 'lib/commands.rb', line 23

def dry_run ; raise NotImplementedError ; end

#priorityObject



4
# File 'lib/commands.rb', line 4

def priority ; nil ; end

#real_runObject

Raises:

  • (NotImplementedError)


24
# File 'lib/commands.rb', line 24

def real_run ; raise NotImplementedError ; end

#runObject



14
15
16
17
18
19
20
21
# File 'lib/commands.rb', line 14

def run
  unless $OPTS[:silent]
    dr=dry_run
    puts(dry_run) if dry_run
  end

  real_run unless $OPTS[:dry_run]
end

#transform(filename) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/commands.rb', line 6

def transform filename
  if path
    File.join path, filename
  else
    File.join '.', filename
  end
end