class Flounder::Field
Attributes
arel_field[R]
@return [Arel::Attribute] arel attribute that corresponds to this field
entity[R]
@return [Entity] entity this field belongs to
name[R]
@return [String] name of this field
Public Class Methods
new(entity, name, arel_field)
click to toggle source
# File lib/flounder/field.rb, line 3 def initialize entity, name, arel_field @entity = entity @name = name @arel_field = arel_field end
Public Instance Methods
==(other)
click to toggle source
Allow comparison and inclusion in hashes.
# File lib/flounder/field.rb, line 35 def == other self.entity == other.entity && self.name == other.name end
Also aliased as: eql?
fully_qualified_name()
click to toggle source
Returns a fully qualified name (table.field).
@return [String] fully qualified field name
# File lib/flounder/field.rb, line 22 def fully_qualified_name entity.with_connection do |conn| table = conn.quote_table_name(entity.table_name) column = conn.quote_column_name(name) "#{table}.#{column}" end end
hash()
click to toggle source
# File lib/flounder/field.rb, line 39 def hash self.entity.hash ^ self.name.hash end
inspect()
click to toggle source
Allow printing for debug purposes
# File lib/flounder/field.rb, line 44 def inspect "<Flounder/Field #{entity} #{name}>" end
Also aliased as: to_s
to_arel_field()
click to toggle source
# File lib/flounder/field.rb, line 30 def to_arel_field arel_field end