Source

RubyCSharp / Dynamic / ruby_dynamic / dynamic_entity.rb

class DynamicEntity

  attr_reader :additional_behavior

  def initialize(additional_behavior)
      @additional_behavior = additional_behavior
  end
  
  def respond_to?(message)
    self.additional_behavior.include?(message)
  end
  
  def method_missing(message, *args, &block)
    if self.additional_behavior.include?(message)
      self.additional_behavior[message].call(self)
    else
      super
    end
   end
end