Module: Metro::SceneView::ClassMethods

Defined in:
lib/metro/views/scene_view.rb

Instance Method Summary collapse

Instance Method Details

#viewObject

Loads and caches the view content based on the avilable view parsers and the view files defined.

Returns:

  • a view object



96
97
98
99
100
101
102
# File 'lib/metro/views/scene_view.rb', line 96

def view
  @view ||=begin
    view = View.new
    view.name = scene_name
    view
  end
end

#view_name(name = nil) ⇒ Object

A Scene by default uses the name of the Scene to find it’s associated view.

Examples:

Custom View Name


class ClosingScene < Metro::Scene
  view_name 'alternative'
end

ClosingScene.view_name # => views/alternative


85
86
87
88
# File 'lib/metro/views/scene_view.rb', line 85

def view_name(name = nil)
  name ? view.name = name : view.name
  view.name
end