Module: Fluffery::Helpers::PageVariables
- Defined in:
- lib/fluffery/helpers/page_variables.rb
Instance Method Summary collapse
- #create_variable(var, content, new_method = true) ⇒ Object
- #description(content = nil) ⇒ Object
- #keywords(content = nil) ⇒ Object
- #page_default(param, data = nil) ⇒ Object
- #page_id(content = nil) ⇒ Object
- #page_title(content = nil) ⇒ Object
Instance Method Details
#create_variable(var, content, new_method = true) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/fluffery/helpers/page_variables.rb', line 30 def create_variable(var, content, new_method = true) content_for(var.to_sym) do content end self.class_eval{ define_method("#{var.to_s}"){ retrieve_variable(var.to_sym) } } if new_method return "" end |
#description(content = nil) ⇒ Object
26 27 28 |
# File 'lib/fluffery/helpers/page_variables.rb', line 26 def description(content = nil) (content.nil?) ? retrieve_variable(:helpful_description) : create_internal_variable(:helpful_description, content) end |
#keywords(content = nil) ⇒ Object
22 23 24 |
# File 'lib/fluffery/helpers/page_variables.rb', line 22 def keywords(content = nil) (content.nil?) ? retrieve_variable(:helpful_keywords) : create_internal_variable(:helpful_keywords, content) end |
#page_default(param, data = nil) ⇒ Object
6 7 8 |
# File 'lib/fluffery/helpers/page_variables.rb', line 6 def page_default(param, data = nil) create_variable("helpful_#{param}", data) unless data.nil? or data.blank? end |
#page_id(content = nil) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/fluffery/helpers/page_variables.rb', line 10 def page_id(content = nil) create_internal_variable(:helpful_page_id, content) and return unless content.nil? return retrieve_variable(:helpful_page_id) if content_for?(:helpful_page_id) cname = controller.class.to_s.gsub(/controller$/i,'').underscore.split("/").join('_') aname = controller.action_name "#{cname}_#{aname}" end |
#page_title(content = nil) ⇒ Object
18 19 20 |
# File 'lib/fluffery/helpers/page_variables.rb', line 18 def page_title(content = nil) (content.nil?) ? retrieve_variable(:helpful_page_title) : create_internal_variable(:helpful_page_title, content) end |