Sha256: 44c9d91a09c552fb41c08daeee705085db429d2e1a88ad8d8491563eaf206a22
Contents?: true
Size: 655 Bytes
Versions: 9
Compression:
Stored size: 655 Bytes
Contents
require "delegate" module Chanko class UnitProxy attr_reader :unit def self.generate_prefix(unit_name) "__#{unit_name}_" end def initialize(unit, context) @unit = unit @context = context end def active?(options = {}) @unit.active?(@context, options) end private def prefix self.class.generate_prefix(@unit.unit_name) end def method_missing(method_name, *args, &block) @context.send("#{prefix}#{method_name}", *args, &block) end def respond_to_missing?(method_name, include_private) @context.respond_to?("#{prefix}#{method_name}") end end end
Version data entries
9 entries across 9 versions & 1 rubygems