Monkeybars::MethodNesting

Public Class Methods

new(nesting_options) click to toggle source
# File lib/monkeybars/view_nesting.rb, line 49
def initialize(nesting_options)
  super
  @add_method, @remove_method = if nesting_options[:using].kind_of? Array
    [nesting_options[:using][0], nesting_options[:using][1]]
  else
    [nesting_options[:using], nil]
  end
end

Public Instance Methods

add(view, nested_view, nested_component, model, transfer) click to toggle source
# File lib/monkeybars/view_nesting.rb, line 70
def add(view, nested_view, nested_component, model, transfer)
  #instance_eval("view.#{@add_method}(@sub_view, model, transfer)")
  raise NameError.new "Add method not provided for nesting #{self}" if @add_method.nil? || !view.respond_to?(@add_method)
  view.send(@add_method, nested_view, nested_component, model, transfer)
end
nests_with_add?() click to toggle source
# File lib/monkeybars/view_nesting.rb, line 62
def nests_with_add?
  !@add_method.nil?
end
nests_with_remove?() click to toggle source
# File lib/monkeybars/view_nesting.rb, line 66
def nests_with_remove?
  !@remove_method.nil?
end
remove(view, nested_view, nested_component, model, transfer) click to toggle source
# File lib/monkeybars/view_nesting.rb, line 76
def remove(view, nested_view, nested_component, model, transfer)
  #instance_eval("view.#{@remove_method}(@sub_view, model, transfer)")
  raise NameError.new "Remove method not provided for nesting #{self}" if @remove_method.nil? || !view.respond_to?(@remove_method)
  view.send(@remove_method, nested_view, nested_component, model, transfer)
end
to_s() click to toggle source
# File lib/monkeybars/view_nesting.rb, line 58
def to_s
  ":sub_view => #{@sub_view.inspect}, :using => [#{@add_method.inspect}, #{@remove_method.inspect}]"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.