Class: ModelWarnings

Inherits:
Hash
  • Object
show all
Defined in:
lib/warn_if/model_warnings.rb

Instance Method Summary collapse

Constructor Details

#initializeModelWarnings

Returns a new instance of ModelWarnings.



2
3
4
5
6
# File 'lib/warn_if/model_warnings.rb', line 2

def initialize
  super
  self[:base] = []
  self
end

Instance Method Details

#allObject



8
9
10
# File 'lib/warn_if/model_warnings.rb', line 8

def all
  values.flatten
end

#clearObject



12
13
14
15
16
# File 'lib/warn_if/model_warnings.rb', line 12

def clear
  # self.keys.each {|k| self[k] = []}
  super
  self[:base] = []
end

#clear?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/warn_if/model_warnings.rb', line 18

def clear?
  keys == [:base] && self[:base] == []
end

#newObject



22
23
24
# File 'lib/warn_if/model_warnings.rb', line 22

def new
  all.select {|w| w.new?}
end

#with_severity(severity) ⇒ Object



26
27
28
# File 'lib/warn_if/model_warnings.rb', line 26

def with_severity(severity)
  all.select {|w| w.severity == severity}
end