Class: PVN::MultipleRevisionsRegexpOption

Inherits:
RevisionRegexpOption show all
Defined in:
lib/pvn/revision/multiple_revisions_option.rb

Overview

A revision option with multiple values.

Constant Summary collapse

REVISION_DESCRIPTION =
RevisionRegexpOption::REVISION_DESCRIPTION + [ "Multiple revisions can be specified." ]

Constants inherited from RevisionRegexpOption

RevisionRegexpOption::TAG_RE

Constants inherited from BaseOption

BaseOption::NO_CMDLINE_OPTION

Instance Attribute Summary

Attributes inherited from RevisionOption

#fromdate, #todate

Attributes inherited from BaseOption

#default, #description, #name, #negate, #regexp, #tag

Instance Method Summary collapse

Methods inherited from RevisionRegexpOption

#initialize

Methods inherited from RevisionOption

#initialize, #to_svn_revision_date, #value

Methods inherited from BaseRevisionOption

#entry, #head?, #relative_to_absolute, #run_log_command

Methods inherited from BaseOption

#exact_match?, #initialize, #negative_match?, #next_argument, #post_process, #process, #regexp_match?, #takes_value?, #to_command_line, #to_doc, #to_s, #unset, #value

Constructor Details

This class inherits a constructor from PVN::RevisionRegexpOption

Instance Method Details

#resolve_value(optset, unprocessed) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/pvn/revision/multiple_revisions_option.rb', line 20

def resolve_value optset, unprocessed
  newvalues = Array.new
  currvalues = value

  currvalues.each do |currval|
    md = TAG_RE.match currval
    if md
      convval = md[2] ? md[3] : relative_to_absolute(currval, unprocessed[0])
      newvalues << convval
    else
      newvalues << currval
    end
  end

  @value = newvalues
end

#set_value(val) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/pvn/revision/multiple_revisions_option.rb', line 11

def set_value val
  currval = value
  if currval
    super [ currval, val ].flatten
  else
    super [ val ]
  end
end