Class: Police::DataFlow::ProxyNumeric

Inherits:
ProxyBase
  • Object
show all
Defined in:
lib/police/dataflow/proxy_numeric.rb

Overview

Base class for labeled Numeric replacements.

Instance Attribute Summary

Attributes inherited from ProxyBase

#__police_class__, #__police_labels__, #__police_proxied__, #__police_stickies__

Instance Method Summary collapse

Methods inherited from ProxyBase

#initialize, #method_missing, #respond_to_missing?

Constructor Details

This class inherits a constructor from Police::DataFlow::ProxyBase

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Police::DataFlow::ProxyBase

Instance Method Details

#coerce(numeric) ⇒ Object

Called when a regular Numeric is added, multiplied, etc to a proxied one.

Wraps the regular Numeric instance with a proxy, so that call dispatch can take place.



11
12
13
14
15
16
17
# File 'lib/police/dataflow/proxy_numeric.rb', line 11

def coerce(numeric)
  if numeric.__police_labels__
    return [numeric, self]
  end
  proxied_numeric = ::Police::DataFlow::Proxying.proxy numeric, {}
  [proxied_numeric, self]
end