Module: CanTango::Model::Filter

Defined in:
lib/cantango/model/filter.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.clean_meth_name(meth_name) ⇒ Object



8
9
10
11
12
13
# File 'lib/cantango/model/filter.rb', line 8

def self.clean_meth_name meth_name
  postfix = (meth_name =~ /\!$/) ? '!' : ''
  postfix = (meth_name =~ /\?$/) ? '?' : postfix
  postfix = "_by#{postfix}"
  meth_name.to_s.sub(/[\!|\?]$/, '') + postfix
end

.included(base) ⇒ Object



3
4
5
6
# File 'lib/cantango/model/filter.rb', line 3

def self.included(base)
  base.send :include, CanTango::Api::User::Ability
  base.extend ClassMethods
end

.normalize_args(args) ⇒ Object



15
16
17
18
# File 'lib/cantango/model/filter.rb', line 15

def self.normalize_args args
  args = args.kind_of?(Symbol) ? [args] : args
  args.map(&:to_s).map{|a| a == 'ARGS' ? '*args' : a}
end