Module: Schema::Attributes

Defined in:
lib/schema/schema.rb

Instance Method Summary collapse

Instance Method Details

#all_attribute_namesObject



95
96
97
# File 'lib/schema/schema.rb', line 95

def all_attribute_names
  attribute_names(include_transient: true)
end

#attribute_names(include_transient: nil) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/schema/schema.rb', line 74

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



70
71
72
# File 'lib/schema/schema.rb', line 70

def attributes
  @attributes ||= AttributeRegistry.new
end