Module: BBLib::Prototype::ClassMethods

Defined in:
lib/bblib/core/mixins/prototype.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



17
18
19
# File 'lib/bblib/core/mixins/prototype.rb', line 17

def method_missing(method, *args, &block)
  prototype.respond_to?(method) ? prototype.send(method, *args, &block) : super
end

Instance Method Details

#prototype(opts = prototype_defaults) ⇒ Object



9
10
11
# File 'lib/bblib/core/mixins/prototype.rb', line 9

def prototype(opts = prototype_defaults)
  @prototype ||= self.new(*prototype_defaults)
end

#prototype_defaultsObject



13
14
15
# File 'lib/bblib/core/mixins/prototype.rb', line 13

def prototype_defaults
  []
end

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

Returns:

  • (Boolean)


21
22
23
# File 'lib/bblib/core/mixins/prototype.rb', line 21

def respond_to_missing?(method, include_private = false)
  prototype.respond_to?(method) || super
end