Class: Framework7::BasePresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/framework7/base_presenter.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, template) ⇒ BasePresenter

Returns a new instance of BasePresenter.



2
3
4
5
# File 'app/presenters/framework7/base_presenter.rb', line 2

def initialize(object, template)
  @object = object
  @template = template
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



17
18
19
20
21
22
23
# File 'app/presenters/framework7/base_presenter.rb', line 17

def method_missing(*args, &block)
  if @template.respond_to? args.first
    @template.send(*args, &block)
  else
    @object.send(*args, &block)
  end
end

Class Method Details

.presents(name) ⇒ Object



7
8
9
10
11
# File 'app/presenters/framework7/base_presenter.rb', line 7

def self.presents(name)
  define_method(name) do
    @object
  end
end

Instance Method Details

#hObject



13
14
15
# File 'app/presenters/framework7/base_presenter.rb', line 13

def h
  @template
end