Class: Godel::Warnings
- Inherits:
-
Object
- Object
- Godel::Warnings
- Defined in:
- lib/godel/warnings.rb
Instance Attribute Summary collapse
-
#messages ⇒ Object
Returns the value of attribute messages.
Instance Method Summary collapse
- #add(symbol, message = nil) ⇒ Object
- #any? ⇒ Boolean
- #blank? ⇒ Boolean
- #clear! ⇒ Object
- #empty? ⇒ Boolean
- #full_messages ⇒ Object
-
#initialize ⇒ Warnings
constructor
A new instance of Warnings.
- #to_a ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize ⇒ Warnings
Returns a new instance of Warnings.
5 6 7 |
# File 'lib/godel/warnings.rb', line 5 def initialize @messages = {} end |
Instance Attribute Details
#messages ⇒ Object
Returns the value of attribute messages.
3 4 5 |
# File 'lib/godel/warnings.rb', line 3 def @messages end |
Instance Method Details
#add(symbol, message = nil) ⇒ Object
13 14 15 16 |
# File 'lib/godel/warnings.rb', line 13 def add(symbol, = nil) ||= "is missing" [symbol] = end |
#any? ⇒ Boolean
18 19 20 |
# File 'lib/godel/warnings.rb', line 18 def any? .any? end |
#blank? ⇒ Boolean
26 27 28 |
# File 'lib/godel/warnings.rb', line 26 def blank? .blank? end |
#clear! ⇒ Object
39 40 41 |
# File 'lib/godel/warnings.rb', line 39 def clear! self. = {} end |
#empty? ⇒ Boolean
22 23 24 |
# File 'lib/godel/warnings.rb', line 22 def empty? .empty? end |
#full_messages ⇒ Object
34 35 36 37 |
# File 'lib/godel/warnings.rb', line 34 def array = [] .each {|k,v| array << "#{k.to_s.titleize} #{v}"} end |
#to_a ⇒ Object
30 31 32 |
# File 'lib/godel/warnings.rb', line 30 def to_a end |
#values ⇒ Object
9 10 11 |
# File 'lib/godel/warnings.rb', line 9 def values .values end |