Class: PivotalTracker::Errors
- Inherits:
-
Object
- Object
- PivotalTracker::Errors
- Includes:
- Enumerable
- Defined in:
- lib/pivotal-tracker/validation.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
(also: #messages)
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #add_from_xml(xml) ⇒ Object
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ Errors
constructor
A new instance of Errors.
Constructor Details
#initialize ⇒ Errors
Returns a new instance of Errors.
9 10 11 |
# File 'lib/pivotal-tracker/validation.rb', line 9 def initialize @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (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 |
#each ⇒ Object
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
19 20 21 |
# File 'lib/pivotal-tracker/validation.rb', line 19 def empty? @errors.empty? end |