Sha256: 2db805dfaac62a967c761c3d0623867628e5bddfa2e15890ecf7226b67c66e23
Contents?: true
Size: 546 Bytes
Versions: 5
Compression:
Stored size: 546 Bytes
Contents
require "delegate" module Nyanko class UnitProxy attr_reader :unit def self.generate_prefix(name) %{__#{name.underscore.gsub("/", "_")}_} 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.name) end def method_missing(method_name, *args, &block) @context.send("#{prefix}#{method_name}", *args, &block) end end end
Version data entries
5 entries across 5 versions & 1 rubygems