module Windcharger::Attributes

Public Instance Methods

attributes() click to toggle source
# File lib/windcharger/attributes.rb, line 5
def attributes
  @__windcharger_attributes ||= []
  super_attrs = superclass.respond_to?(:attributes) ? superclass.attributes : []
  [*super_attrs, *@__windcharger_attributes].freeze
end

Private Instance Methods

__windcharger_add_attribute(name) click to toggle source
# File lib/windcharger/attributes.rb, line 13
def __windcharger_add_attribute name
  (@__windcharger_attributes ||= []) << name.to_sym
end
attribute(*attributes) click to toggle source
# File lib/windcharger/attributes.rb, line 17
def attribute *attributes
  if attributes.any?
    attributes.each { |attribute| __windcharger_add_attribute attribute }
  else
    @__windcharger_next_is_attribute = true
  end
end
method_added(name) click to toggle source
Calls superclass method
# File lib/windcharger/attributes.rb, line 25
def method_added name
  super
  return unless defined?(@__windcharger_next_is_attribute) && @__windcharger_next_is_attribute
  __windcharger_add_attribute name
  @__windcharger_next_is_attribute = false
end