Class: Nucleo::Models::Checks
- Inherits:
-
Object
- Object
- Nucleo::Models::Checks
- Includes:
- Enumerable
- Defined in:
- lib/nucleo/models/checks.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#find_by_type(type) ⇒ Nucleo::Models::ChangeType
Retrieve a check by type.
- #find_content ⇒ Object
- #find_image_src ⇒ Object
-
#initialize(collection) ⇒ Nucleo::Models::Changes
constructor
Return an instance of the Rules collection domain model.
Constructor Details
#initialize(collection) ⇒ Nucleo::Models::Changes
Return an instance of the Rules collection domain model
11 12 13 |
# File 'lib/nucleo/models/checks.rb', line 11 def initialize(collection) @collection = Array(collection) end |
Instance Method Details
#each(&block) ⇒ Object
15 16 17 |
# File 'lib/nucleo/models/checks.rb', line 15 def each(&block) internal_collection.each(&block) end |
#find_by_type(type) ⇒ Nucleo::Models::ChangeType
Retrieve a check by type
22 23 24 |
# File 'lib/nucleo/models/checks.rb', line 22 def find_by_type(type) self.find { |record| record.type == type } end |
#find_content ⇒ Object
26 27 28 29 30 31 |
# File 'lib/nucleo/models/checks.rb', line 26 def find_content content = self.collect { |r| r.elements.find_content }.flatten.first return "" if content.blank? content end |
#find_image_src ⇒ Object
33 34 35 |
# File 'lib/nucleo/models/checks.rb', line 33 def find_image_src self.collect { |r| r.elements.find_image_src }.flatten end |