Module: Lark::Helper::ClassMethods

Defined in:
lib/lark/helper.rb

Instance Method Summary collapse

Instance Method Details

#api_mount(name) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/lark/helper.rb', line 6

def api_mount(name)
  class_eval <<-CODE, __FILE__, __LINE__ + 1
    def #{name.to_s.gsub('/', '_')}
      @#{name.to_s.gsub('/', '_')} ||= Class.new(SimpleDelegator) do
        include ::Lark::Apis::#{name.to_s.classify}
      end.new(self)
    end
  CODE
end