Class: PointRb::LayoutManager

Inherits:
Object
  • Object
show all
Defined in:
lib/pointrb/layout_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(layout_files, project) ⇒ LayoutManager

Returns a new instance of LayoutManager.



5
6
7
8
9
10
11
# File 'lib/pointrb/layout_manager.rb', line 5

def initialize(layout_files, project)
  @layout_files = layout_files
  @project = project

  @layout_contructor = LayoutConstructor.new(project)
  @layouts = @layout_files.collect { |f| construct_layout(f.content, f.path) }
end

Instance Method Details

#retrieve(name) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/pointrb/layout_manager.rb', line 13

def retrieve(name)
  result_of_search = @layouts.find { |l| l.name == name }

  raise Exceptions::LayoutNotFound, "Sorry I'm not able to find the requested layout file (#{name}). Please make sure it's avaiable at the layout directory."  unless result_of_search

  result_of_search
end