Sha256: dc8202d482b3ad36d7d636981bc6d6aa9c69bda4a61f9e23842610f3e894e478

Contents?: true

Size: 447 Bytes

Versions: 3

Compression:

Stored size: 447 Bytes

Contents

module Monologue
  module ConfigurationExtensions
    def add_class(name)
      self.instance_variable_set "@#{name}", Set.new

      create_method("#{name}=".to_sym) { |val|
        instance_variable_set("@" + name, val)
      }

      create_method(name.to_sym) do
        instance_variable_get("@" + name)
      end
    end

    private

    def create_method(name, &block)
      self.class.send(:define_method, name, &block)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
monologue-0.5.0 lib/monologue/configuration_extensions.rb
monologue-0.4.1 lib/monologue/configuration_extensions.rb
monologue-0.4.0 lib/monologue/configuration_extensions.rb