Sha256: c305d9f1d59130dee54fd79e586a4bdf587e5e4ab9e4861784ff730c72685a84

Contents?: true

Size: 600 Bytes

Versions: 49

Compression:

Stored size: 600 Bytes

Contents

module Rundock
  module Attribute
    class Base
      def initialize(attr = {})
        attr.each { |k, v| define_attr(k.to_sym, v) }
      end

      def self.attr_accessor(*vars)
        @attributes ||= []
        @attributes.concat(vars)
        super(*vars)
      end

      def self.list
        @attributes
      end

      def list
        self.class.list.each_with_object({}) do |a, result|
          result[a] = self.send(a)
        end
      end

      def define_attr(name, val)
        self.class.send(:attr_accessor, name)
        self.send("#{name}=", val)
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
rundock-1.2.1 lib/rundock/attribute/base.rb
rundock-1.2.0 lib/rundock/attribute/base.rb
rundock-1.1.7 lib/rundock/attribute/base.rb
rundock-1.1.6 lib/rundock/attribute/base.rb
rundock-1.1.5 lib/rundock/attribute/base.rb
rundock-1.1.4 lib/rundock/attribute/base.rb
rundock-1.1.3 lib/rundock/attribute/base.rb
rundock-1.1.2 lib/rundock/attribute/base.rb
rundock-1.1.1 lib/rundock/attribute/base.rb
rundock-1.1.0 lib/rundock/attribute/base.rb
rundock-1.0.8 lib/rundock/attribute/base.rb
rundock-1.0.7 lib/rundock/attribute/base.rb
rundock-1.0.6 lib/rundock/attribute/base.rb
rundock-1.0.5 lib/rundock/attribute/base.rb
rundock-1.0.4 lib/rundock/attribute/base.rb
rundock-1.0.2 lib/rundock/attribute/base.rb
rundock-1.0.1 lib/rundock/attribute/base.rb
rundock-1.0.0 lib/rundock/attribute/base.rb
rundock-0.5.8 lib/rundock/attribute/base.rb
rundock-0.5.7 lib/rundock/attribute/base.rb