Class: ActiveRecord::ConnectionAdapters::CheckConstraintDefinition

Inherits:
Struct
  • Object
show all
Defined in:
lib/active_record/connection_adapters/abstract/schema_definitions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#expressionObject

Returns the value of attribute expression

Returns:

  • (Object)

    the current value of expression



174
175
176
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 174

def expression
  @expression
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



174
175
176
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 174

def options
  @options
end

#table_nameObject

Returns the value of attribute table_name

Returns:

  • (Object)

    the current value of table_name



174
175
176
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 174

def table_name
  @table_name
end

Instance Method Details

#defined_for?(name:, expression: nil, validate: nil, **options) ⇒ Boolean

Returns:

  • (Boolean)


188
189
190
191
192
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 188

def defined_for?(name:, expression: nil, validate: nil, **options)
  self.name == name.to_s &&
    (validate.nil? || validate == self.options.fetch(:validate, validate)) &&
    options.all? { |k, v| self.options[k].to_s == v.to_s }
end

#export_name_on_schema_dump?Boolean

Returns:

  • (Boolean)


184
185
186
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 184

def export_name_on_schema_dump?
  !ActiveRecord::SchemaDumper.chk_ignore_pattern.match?(name) if name
end

#nameObject



175
176
177
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 175

def name
  options[:name]
end

#validate?Boolean Also known as: validated?

Returns:

  • (Boolean)


179
180
181
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 179

def validate?
  options.fetch(:validate, true)
end