Module: Schema::Attributes

Defined in:
lib/schema/schema.rb

Instance Method Summary collapse

Instance Method Details

#all_attribute_namesObject



107
108
109
# File 'lib/schema/schema.rb', line 107

def all_attribute_names
  attribute_names(include_transient: true)
end

#attribute_names(include_transient: nil) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/schema/schema.rb', line 86

def attribute_names(include_transient: nil)
  include_transient ||= false

  transient_attributes = []
  if respond_to?(:transient_attributes)
    transient_attributes = self.transient_attributes
  end

  attribute_names = []
  attributes.each do |attribute|
    if !include_transient &&
        transient_attributes.include?(attribute.name)
      next
    end

    attribute_names << attribute.name
  end

  attribute_names
end

#attributesObject



82
83
84
# File 'lib/schema/schema.rb', line 82

def attributes
  @attributes ||= AttributeRegistry.new
end