Module: Commutator::Model::Attributes::ClassMethods

Defined in:
lib/commutator/model/attributes.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#attribute(*attr_names) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/commutator/model/attributes.rb', line 44

def attribute(*attr_names)
  options = attr_names.extract_options!

  attr_names.each do |attr_name|
    attribute_names << attr_name

    # Skip reader and writer methods entirely
    next if options[:accessor] == false

    define_writer(attr_name, options) unless options[:writer] == false
    attr_reader attr_name unless options[:reader] == false
  end
end

#attribute_namesObject



58
59
60
# File 'lib/commutator/model/attributes.rb', line 58

def attribute_names
  @attribute_names ||= Set.new
end