Class: ActiveadminSelleoCms::Layout
- Inherits:
-
Object
- Object
- ActiveadminSelleoCms::Layout
- Defined in:
- app/models/activeadmin_selleo_cms/layout.rb
Defined Under Namespace
Classes: Section
Class Method Summary collapse
Instance Method Summary collapse
- #find_section(name) ⇒ Object
-
#initialize(path) ⇒ Layout
constructor
A new instance of Layout.
- #section_names ⇒ Object
- #sections ⇒ Object
Constructor Details
#initialize(path) ⇒ Layout
Returns a new instance of Layout.
5 6 7 8 9 |
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 5 def initialize(path) @path = path @file = File.read(path) @doc = Nokogiri::HTML(@file) end |
Class Method Details
.all ⇒ Object
34 35 36 |
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 34 def all Dir.glob(File.join(Rails.root, 'app/views/layouts/[a-z]*html.erb')).map{|l| l.split('/').last.split('.').first } end |
Instance Method Details
#find_section(name) ⇒ Object
21 22 23 |
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 21 def find_section(name) sections.detect{|section| section.name == name} end |
#section_names ⇒ Object
11 12 13 |
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 11 def section_names @section_names ||= sections.map(&:name) end |