Module: Expositor

Defined in:
lib/expositor.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



2
3
4
5
6
7
8
# File 'lib/expositor.rb', line 2

def method_missing(method_name, *args, &block)
  if expose_all? || valid_method?(method_name)
    new(*args).send(method_name)
  else
    super
  end
end

Instance Method Details

#expose(only: nil, except: nil) ⇒ Object



10
11
12
13
# File 'lib/expositor.rb', line 10

def expose(only: nil, except: nil)
  @only   = only   || []
  @except = except || []
end