Class: SvnLog::Args

Inherits:
SVNx::CommandArgs show all
Includes:
Logue::Loggable
Defined in:
lib/svnx/log/args.rb

Direct Known Subclasses

SVNx::LogCmdLine::LogCommandArgs

Instance Attribute Summary collapse

Attributes inherited from SVNx::CommandArgs

#path

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Args

Returns a new instance of Args.



19
20
21
22
23
24
25
# File 'lib/svnx/log/args.rb', line 19

def initialize args
  @limit = args[:limit]
  @verbose = args[:verbose]
  @use_cache = args.key?(:use_cache) ? args[:use_cache] : false
  @revision = args[:revision]
  super
end

Instance Attribute Details

#limitObject (readonly)

Returns the value of attribute limit.



14
15
16
# File 'lib/svnx/log/args.rb', line 14

def limit
  @limit
end

#revisionObject (readonly)

Returns the value of attribute revision.



16
17
18
# File 'lib/svnx/log/args.rb', line 16

def revision
  @revision
end

#use_cacheObject (readonly)

Returns the value of attribute use_cache.



17
18
19
# File 'lib/svnx/log/args.rb', line 17

def use_cache
  @use_cache
end

#verboseObject (readonly)

Returns the value of attribute verbose.



15
16
17
# File 'lib/svnx/log/args.rb', line 15

def verbose
  @verbose
end

Instance Method Details

#to_aObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/svnx/log/args.rb', line 27

def to_a
  ary = Array.new
  if @limit
    ary << '--limit' << @limit
  end
  if @verbose
    ary << '-v'
  end

  if @revision
    [ @revision ].flatten.each do |rev|
      ary << "-r#{rev}"
    end
  end

  if @path
    ary << @path
  end
  
  ary.compact
end