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-0.5.4 lib/rundock/attribute/base.rb
rundock-0.5.3 lib/rundock/attribute/base.rb
rundock-0.5.2 lib/rundock/attribute/base.rb
rundock-0.5.0 lib/rundock/attribute/base.rb
rundock-0.4.16 lib/rundock/attribute/base.rb
rundock-0.4.15 lib/rundock/attribute/base.rb
rundock-0.4.14 lib/rundock/attribute/base.rb
rundock-0.4.13 lib/rundock/attribute/base.rb
rundock-0.4.12 lib/rundock/attribute/base.rb
rundock-0.4.11 lib/rundock/attribute/base.rb
rundock-0.4.10 lib/rundock/attribute/base.rb
rundock-0.4.8 lib/rundock/attribute/base.rb
rundock-0.4.7 lib/rundock/attribute/base.rb
rundock-0.4.6 lib/rundock/attribute/base.rb
rundock-0.4.4 lib/rundock/attribute/base.rb
rundock-0.4.3 lib/rundock/attribute/base.rb
rundock-0.4.2 lib/rundock/attribute/base.rb
rundock-0.4.1 lib/rundock/attribute/base.rb
rundock-0.4.0 lib/rundock/attribute/base.rb
rundock-0.3.0 lib/rundock/attribute/base.rb