Module: Germinate::SharedStyleAttributes
Constant Summary collapse
- TEXT_TRANSFORMS =
Germinate::TextTransforms.singleton_methods
Instance Method Summary collapse
- #copy_attributes!(attributes, override = true) ⇒ Object
- #copy_shared_style_attributes_from(other, override = true) ⇒ Object
- #disable_all_transforms! ⇒ Object
- #shared_style_attributes ⇒ Object
Instance Method Details
#copy_attributes!(attributes, override = true) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/germinate/shared_style_attributes.rb', line 47 def copy_attributes!(attributes, override=true) attributes.each_pair do |key, value| if !value.nil? && (override || !send(key)) self.send(key, value) end end end |
#copy_shared_style_attributes_from(other, override = true) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/germinate/shared_style_attributes.rb', line 36 def copy_shared_style_attributes_from(other, override=true) case other when Germinate::SharedStyleAttributes copy_attributes!(other.shared_style_attributes) when Hash copy_attributes!(other, override) else raise "Don't know how to copy attributes from #{other.inspect}" end end |
#disable_all_transforms! ⇒ Object
21 22 23 24 25 |
# File 'lib/germinate/shared_style_attributes.rb', line 21 def disable_all_transforms! TEXT_TRANSFORMS.each do |transform| self.send("#{transform}=", false) end end |
#shared_style_attributes ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/germinate/shared_style_attributes.rb', line 27 def shared_style_attributes Germinate::SharedStyleAttributes.fattrs.inject({}) { |attributes, key| attributes[key] = send(key) attributes } end |