module Logicum::ClassAttribute::ClassMethods

Public Instance Methods

class_attribute(*attributes) click to toggle source
# File lib/logicum/class_attribute.rb, line 14
def class_attribute(*attributes)
  singleton_class.class_eval do
    attr_accessor *attributes
  end

  class_attributes.merge attributes
end

Protected Instance Methods

inherited(subclass) click to toggle source
Calls superclass method
# File lib/logicum/class_attribute.rb, line 24
def inherited(subclass)
  class_attributes.each do |attribute|
    value = send(attribute).dup
    subclass.class_attribute attribute
    subclass.send "#{attribute}=", value
  end

  super
end

Private Instance Methods

class_attributes() click to toggle source
# File lib/logicum/class_attribute.rb, line 36
def class_attributes
  @class_attributes ||= Set.new
end