Module: Thwart::Ables

Included in:
Resource
Defined in:
lib/thwart/canable.rb

Overview

Module in which the [action]able_by? 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



24
25
26
27
28
# File 'lib/thwart/canable.rb', line 24

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

Instance Method Details

#respond_to?(*args) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/thwart/canable.rb', line 19

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