Class: Workarea::StyleGuidesHelper::Partials
- Inherits:
-
Object
- Object
- Workarea::StyleGuidesHelper::Partials
- Defined in:
- app/helpers/workarea/style_guides_helper.rb
Instance Method Summary collapse
-
#initialize(root, scope, category) ⇒ Partials
constructor
A new instance of Partials.
- #name_from(path) ⇒ Object
- #pattern ⇒ Object
- #to_a ⇒ Object
Constructor Details
Instance Method Details
#name_from(path) ⇒ Object
21 22 23 24 25 |
# File 'app/helpers/workarea/style_guides_helper.rb', line 21 def name_from(path) path .gsub("#{@root}/app/views/", '') .gsub(/\/_(.+)\.html.*/, '/\1') end |
#pattern ⇒ Object
10 11 12 |
# File 'app/helpers/workarea/style_guides_helper.rb', line 10 def pattern "#{@root}/app/views/workarea/#{@scope}/style_guides/#{@category}/*.html*" end |
#to_a ⇒ Object
14 15 16 17 18 19 |
# File 'app/helpers/workarea/style_guides_helper.rb', line 14 def to_a Dir[pattern] .map { |path| name_from(path) } .uniq .sort end |