Module: Schema::Attributes

Defined in:
lib/schema/schema.rb

Instance Method Summary collapse

Instance Method Details

#all_attribute_namesObject



102
103
104
# File 'lib/schema/schema.rb', line 102

def all_attribute_names
  attribute_names(include_transient: true)
end

#attribute_names(include_transient: nil) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/schema/schema.rb', line 81

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



77
78
79
# File 'lib/schema/schema.rb', line 77

def attributes
  @attributes ||= AttributeRegistry.new
end