Class: ActionCost::RecordCacheParser

Inherits:
Object
  • Object
show all
Defined in:
lib/action_cost/record_cache_parser.rb

Constant Summary collapse

VALID_OPERATIONS =
%w{ select insert update delete }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_name) ⇒ RecordCacheParser

Returns a new instance of RecordCacheParser.



7
8
9
10
11
12
# File 'lib/action_cost/record_cache_parser.rb', line 7

def initialize(table_name)
  @invalid  = false
  @table_name = table_name
  @join_tables = []
  @operation = 'select'
end

Instance Attribute Details

#invalidObject (readonly)

Returns the value of attribute invalid.



3
4
5
# File 'lib/action_cost/record_cache_parser.rb', line 3

def invalid
  @invalid
end

#join_tablesObject (readonly)

Returns the value of attribute join_tables.



3
4
5
# File 'lib/action_cost/record_cache_parser.rb', line 3

def join_tables
  @join_tables
end

#operationObject (readonly)

Returns the value of attribute operation.



3
4
5
# File 'lib/action_cost/record_cache_parser.rb', line 3

def operation
  @operation
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



3
4
5
# File 'lib/action_cost/record_cache_parser.rb', line 3

def table_name
  @table_name
end

Instance Method Details

#logObject



18
19
20
21
22
23
24
25
# File 'lib/action_cost/record_cache_parser.rb', line 18

def log
  if @invalid
    Rails.logger.debug "action_cost: record cache non parsable query"
  else
    Rails.logger.debug "action_cost: record_cache operation=#{@operation} table_name=#{@table_name} " +
                       "join_tables=#{@join_tables.inspect}"
  end
end

#parseObject



14
15
16
# File 'lib/action_cost/record_cache_parser.rb', line 14

def parse
  return true
end