Module: ActionHero::Grape::Endpoint

Defined in:
lib/action_hero/grape/endpoint.rb

Instance Method Summary collapse

Instance Method Details

#expose(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/action_hero/grape/endpoint.rb', line 5

def expose( *args )
  args.last.tap do |value|
    if args.size > 1
      name = args.first.is_a?( Symbol ) ? args.first : (raise NotImplementedError)
      self.class.send( :define_method, name, lambda { value } )
    end

    body( value )
  end
end