Class: Mystique::PresenterClass

Inherits:
Object
  • Object
show all
Defined in:
lib/mystique/presenter_class.rb

Instance Method Summary collapse

Constructor Details

#initialize(object, with = nil) ⇒ PresenterClass

Returns a new instance of PresenterClass.



3
4
5
6
# File 'lib/mystique/presenter_class.rb', line 3

def initialize(object, with=nil)
  @with   = with
  @object = object
end

Instance Method Details

#class_nameObject



12
13
14
15
16
# File 'lib/mystique/presenter_class.rb', line 12

def class_name
  return with.to_s if with

  "#{base_class_name(object)}Presenter"
end

#to_classObject



8
9
10
# File 'lib/mystique/presenter_class.rb', line 8

def to_class
  with || Object.send(:const_get, class_name)
end