Module: Thwart::Cans

Defined in:
lib/thwart/canable.rb

Overview

Module in which the can_? methods hang out

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



10
11
12
13
14
# File 'lib/thwart/canable.rb', line 10

def method_missing(name, *args, &block)
  can = Thwart::Actions.find_can(name)
  return Thwart.query(self, args.first, can) if args.length == 1 && !!can
  super
end

Instance Method Details

#respond_to?(*args) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
# File 'lib/thwart/canable.rb', line 5

def respond_to?(*args)
  return true if Thwart::Actions.find_can(args.first) != false
  super
end