Class: Pulitzer::Version
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Pulitzer::Version
- Includes:
- ForeignOffice::Broadcaster
- Defined in:
- app/models/pulitzer/version.rb
Instance Attribute Summary collapse
-
#processed_element_count ⇒ Object
Returns the value of attribute processed_element_count.
Instance Method Summary collapse
- #content_element(label) ⇒ Object
- #has_label(label) ⇒ Object
- #has_label_type(label_type) ⇒ Object
- #post_tags_for(label_type) ⇒ Object
- #section(name) ⇒ Object
- #serialize ⇒ Object
- #template_content_elements ⇒ Object
- #total_processing_elements ⇒ Object
Instance Attribute Details
#processed_element_count ⇒ Object
Returns the value of attribute processed_element_count.
12 13 14 |
# File 'app/models/pulitzer/version.rb', line 12 def processed_element_count @processed_element_count end |
Instance Method Details
#content_element(label) ⇒ Object
30 31 32 |
# File 'app/models/pulitzer/version.rb', line 30 def content_element(label) self.content_elements.to_a.detect{|ce| ce.label == label} end |
#has_label(label) ⇒ Object
22 23 24 |
# File 'app/models/pulitzer/version.rb', line 22 def has_label(label) .to_a.select{|pt| pt.label_type == label.class.name && pt.label_id == label.id}.any? end |
#has_label_type(label_type) ⇒ Object
18 19 20 |
# File 'app/models/pulitzer/version.rb', line 18 def has_label_type(label_type) .to_a.select{|pt| pt.label_type == label_type}.any? end |
#post_tags_for(label_type) ⇒ Object
26 27 28 |
# File 'app/models/pulitzer/version.rb', line 26 def (label_type) .to_a.select{|pt| pt.label_type == label_type} end |
#section(name) ⇒ Object
34 35 36 |
# File 'app/models/pulitzer/version.rb', line 34 def section(name) self.free_form_sections.to_a.detect{|ffs| ffs.name == name} end |
#serialize ⇒ Object
46 47 48 49 |
# File 'app/models/pulitzer/version.rb', line 46 def serialize self.attributes.merge \ processed_element_count: self.processed_element_count end |
#template_content_elements ⇒ Object
38 39 40 |
# File 'app/models/pulitzer/version.rb', line 38 def template_content_elements content_elements.template end |
#total_processing_elements ⇒ Object
42 43 44 |
# File 'app/models/pulitzer/version.rb', line 42 def total_processing_elements active_version.content_elements.count + active_version..count + active_version.free_form_sections.count + 2 end |