Class: ActiveRecordPgStuff::Relation::TemporaryTable::Decorator

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord_pg_stuff/relation/temporary_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, table_name) ⇒ Decorator

Returns a new instance of Decorator.



9
10
11
12
13
14
15
16
# File 'lib/activerecord_pg_stuff/relation/temporary_table.rb', line 9

def initialize(object, table_name)
  @table_name        = table_name
  @object            = object
  @arel_table        = Arel::Table.new(table_name)
  @quoted_table_name = @object.connection.quote_table_name(table_name)
  @table_metadata    = ActiveRecord::TableMetadata.new(self, @arel_table)
  @predicate_builder = ActiveRecord::PredicateBuilder.new(@table_metadata)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



18
19
20
# File 'lib/activerecord_pg_stuff/relation/temporary_table.rb', line 18

def method_missing(name, *args, &block)
  @object.send(name, *args, &block)
end

Instance Attribute Details

#arel_tableObject (readonly)

Returns the value of attribute arel_table.



7
8
9
# File 'lib/activerecord_pg_stuff/relation/temporary_table.rb', line 7

def arel_table
  @arel_table
end

#predicate_builderObject (readonly)

Returns the value of attribute predicate_builder.



7
8
9
# File 'lib/activerecord_pg_stuff/relation/temporary_table.rb', line 7

def predicate_builder
  @predicate_builder
end

#quoted_table_nameObject (readonly)

Returns the value of attribute quoted_table_name.



7
8
9
# File 'lib/activerecord_pg_stuff/relation/temporary_table.rb', line 7

def quoted_table_name
  @quoted_table_name
end

#table_metadataObject (readonly)

Returns the value of attribute table_metadata.



7
8
9
# File 'lib/activerecord_pg_stuff/relation/temporary_table.rb', line 7

def 
  @table_metadata
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



7
8
9
# File 'lib/activerecord_pg_stuff/relation/temporary_table.rb', line 7

def table_name
  @table_name
end

Instance Method Details

#respond_to?(name, *args) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/activerecord_pg_stuff/relation/temporary_table.rb', line 22

def respond_to?(name, *args)
  @object.respond_to?(name, *args)
end