Module: Ramaze::Helper::REST

Defined in:
lib/ramaze/helper/rest.rb

Defined Under Namespace

Modules: Indicate

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ramaze/helper/rest.rb', line 4

def self.included(klass)
  klass.class_eval do
    trait :REST => {
      'GET' => [], 'PUT' => [],
      'POST' => [], 'DELETE' => [],
      :any => [],
    }
    extend Indicate

    def self.method_added(name)
      name = name.to_s
      active = trait[:REST][:active] ||= :any
      trait[:REST][active] << name
    end
  end
end