Class: Maven::Parameter

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

Instance Attribute Summary collapse

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods inherited from Base

#prepare, #skip_to, #until

Constructor Details

#initialize(parent) ⇒ Parameter

Returns a new instance of Parameter.



382
383
384
# File 'lib/maven.rb', line 382

def initialize(parent)
  @parent = parent
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



379
380
381
# File 'lib/maven.rb', line 379

def description
  @description
end

#directly_editableObject

Returns the value of attribute directly_editable.



380
381
382
# File 'lib/maven.rb', line 380

def directly_editable
  @directly_editable
end

#indexObject

Returns the value of attribute index.



380
381
382
# File 'lib/maven.rb', line 380

def index
  @index
end

#nameObject

Returns the value of attribute name.



379
380
381
# File 'lib/maven.rb', line 379

def name
  @name
end

#requiredObject

Returns the value of attribute required.



380
381
382
# File 'lib/maven.rb', line 380

def required
  @required
end

#typeObject

Returns the value of attribute type.



380
381
382
# File 'lib/maven.rb', line 380

def type
  @type
end

Instance Method Details

#process(line) ⇒ Object



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/maven.rb', line 386

def process(line)
  return parent if /^#{'=' * 40}/ =~ line
  case @status || :none
  when :none
    if /\[(\d+?)\] Name: (.*)/ =~ line
      @index = $1.to_i
      @name = $2.strip
      @status = :attributes
    end
    self
  when :attributes
    self.until(line, /^Description\:/, :description) do
      key, value = *line.split(':', 2)
      words = *key.split(' ')
      send("#{words.map{|s|s.downcase}.join('_')}=", value.strip)
    end
    self
  when :description
    if /^#{'-' * 40}/ =~ line
      parent.new_parameter
    else
      self.description ||= []
      self.description << line.strip
      self
    end
  else
    raise "unimplemented"
  end
end