Sha256: 703794f392e01bb424374818d3b0f953f74b0784d181e54ed7bf465294989c9e

Contents?: true

Size: 794 Bytes

Versions: 31

Compression:

Stored size: 794 Bytes

Contents

module Torque
  module PostgreSQL
    module Collector

      # This classe helps to collect data in different ways. Used to configure
      # auxiliary statements
      def self.new(*args)
        klass = Class.new

        args.flatten!
        args.compact!

        klass.module_eval do
          args.each do |attribute|
            define_method attribute do |*args|
              if args.empty?
                instance_variable_get("@#{attribute}")
              elsif args.size > 1
                instance_variable_set("@#{attribute}", args)
              else
                instance_variable_set("@#{attribute}", args.first)
              end
            end
            alias_method "#{attribute}=", attribute
          end
        end

        klass
      end

    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
torque-postgresql-1.1.8 lib/torque/postgresql/collector.rb
torque-postgresql-1.1.7 lib/torque/postgresql/collector.rb
torque-postgresql-2.0.3 lib/torque/postgresql/collector.rb
torque-postgresql-2.0.2 lib/torque/postgresql/collector.rb
torque-postgresql-1.1.6 lib/torque/postgresql/collector.rb
torque-postgresql-1.1.5 lib/torque/postgresql/collector.rb
torque-postgresql-2.0.1 lib/torque/postgresql/collector.rb
torque-postgresql-2.0.0 lib/torque/postgresql/collector.rb
torque-postgresql-1.1.4 lib/torque/postgresql/collector.rb
torque-postgresql-1.1.3 lib/torque/postgresql/collector.rb
torque-postgresql-1.1.2 lib/torque/postgresql/collector.rb
torque-postgresql-1.1.1 lib/torque/postgresql/collector.rb
torque-postgresql-1.1.0 lib/torque/postgresql/collector.rb
torque-postgresql-1.0.1 lib/torque/postgresql/collector.rb
torque-postgresql-1.0.0 lib/torque/postgresql/collector.rb
torque-postgresql-0.2.16 lib/torque/postgresql/collector.rb
torque-postgresql-0.2.15 lib/torque/postgresql/collector.rb
torque-postgresql-0.2.14 lib/torque/postgresql/collector.rb
torque-postgresql-0.2.13 lib/torque/postgresql/collector.rb
torque-postgresql-0.2.12 lib/torque/postgresql/collector.rb