Module: LLT::Core::ClassMethods

Defined in:
lib/llt/core/serviceable.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object



118
119
120
121
122
123
124
125
126
# File 'lib/llt/core/serviceable.rb', line 118

def method_missing(meth, *args, &blk)
  if meth.match(/^uses_(.*)/)
    key = $1.to_sym
    used_services[key] = blk
    attr_accessor key
  else
    super
  end
end

Instance Method Details

#default_optionsObject



110
111
112
# File 'lib/llt/core/serviceable.rb', line 110

def default_options
  {}
end

#respond_to_missing?(meth, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/llt/core/serviceable.rb', line 128

def respond_to_missing?(meth, include_private = false)
  meth.match(/^uses_(.*)/) || super
end

#used_servicesObject



114
115
116
# File 'lib/llt/core/serviceable.rb', line 114

def used_services
  @used_services ||= {}
end