class Mystique::PresenterClass
Attributes
object[R]
with[R]
Public Class Methods
new(object, with=nil)
click to toggle source
# File lib/mystique/presenter_class.rb, line 3 def initialize(object, with=nil) @with = with @object = object end
Public Instance Methods
class_name()
click to toggle source
# File lib/mystique/presenter_class.rb, line 12 def class_name return with.to_s if with "#{base_class_name(object)}Presenter" end
to_class()
click to toggle source
# File lib/mystique/presenter_class.rb, line 8 def to_class with || Object.send(:const_get, class_name) end
Private Instance Methods
base_class_name(for_object)
click to toggle source
# File lib/mystique/presenter_class.rb, line 23 def base_class_name(for_object) case for_object when Symbol, String for_object.to_s.split(/_/).map(&:capitalize).join when Array for_object.map { |current_object| base_class_name(current_object) }.join("::") else for_object.class.to_s end end