Class: PivotalTracker::Errors

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/pivotal-tracker/validation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeErrors

Returns a new instance of Errors.



9
10
11
# File 'lib/pivotal-tracker/validation.rb', line 9

def initialize
  @errors = []
end

Instance Attribute Details

#errorsObject (readonly) Also known as: messages

Returns the value of attribute errors.



5
6
7
# File 'lib/pivotal-tracker/validation.rb', line 5

def errors
  @errors
end

Instance Method Details

#add_from_xml(xml) ⇒ Object



23
24
25
26
27
# File 'lib/pivotal-tracker/validation.rb', line 23

def add_from_xml(xml)
  Nokogiri::XML(xml).xpath("/errors/error").each do |error|
    @errors << error.text
  end
end

#eachObject



13
14
15
16
17
# File 'lib/pivotal-tracker/validation.rb', line 13

def each
  @errors.each do |error|
    yield error
  end
end

#empty?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/pivotal-tracker/validation.rb', line 19

def empty?
  @errors.empty?
end