Module: Middleman::Org::Helpers
- Defined in:
- lib/middleman-org/helpers.rb
Class Method Summary collapse
Instance Method Summary collapse
- #articles(org_name = nil) ⇒ Object
- #current_article ⇒ Object
- #org_article? ⇒ Boolean
- #org_controller(org_name = nil) ⇒ Object
- #org_data(org_name = nil) ⇒ Object
- #org_instances ⇒ Object
Class Method Details
Instance Method Details
#articles(org_name = nil) ⇒ Object
47 48 49 |
# File 'lib/middleman-org/helpers.rb', line 47 def articles(org_name = nil) org_data(org_name).articles end |
#current_article ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/middleman-org/helpers.rb', line 38 def current_article article = current_resource if article && article.is_a?(OrgArticle) article else nil end end |
#org_article? ⇒ Boolean
34 35 36 |
# File 'lib/middleman-org/helpers.rb', line 34 def org_article? !current_article.nil? end |
#org_controller(org_name = nil) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/middleman-org/helpers.rb', line 20 def org_controller(org_name = nil) # Warn if a non-existent org name provided if org_name && !org_instances.keys.include?(org_name.to_sym) fail "Non-existent org name provided: #{org_name}." end org_name ||= org_instances.keys.first org_instances[org_name.to_sym] end |
#org_data(org_name = nil) ⇒ Object
30 31 32 |
# File 'lib/middleman-org/helpers.rb', line 30 def org_data(org_name = nil) org_controller(org_name).data end |