class GenericViewMapper::View

Attributes

target[R]

Public Class Methods

applies_to(*classes) click to toggle source
# File lib/generic_view_mapper/view.rb, line 14
def self.applies_to(*classes)
  @applies_to ||= classes
end
applies_to?(object) click to toggle source
# File lib/generic_view_mapper/view.rb, line 18
def self.applies_to?(object)
  klass = object.is_a?(Class) ? object : object.class
  @applies_to.include?(klass)
end
new(target) click to toggle source
# File lib/generic_view_mapper/view.rb, line 25
def initialize(target)
  @target = target
end

Public Instance Methods

as_json(*) click to toggle source
# File lib/generic_view_mapper/view.rb, line 29
def as_json(*)
  render(target, self)
end