Class: ActiveWarehouse::AggregateKey

Inherits:
Object
  • Object
show all
Defined in:
lib/active_warehouse/aggregate.rb

Overview

Key for aggregate caching

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dimension1, dimension1_hierarchy, dimension2, dimension2_hierarchy) ⇒ AggregateKey

Returns a new instance of AggregateKey.



234
235
236
237
238
239
# File 'lib/active_warehouse/aggregate.rb', line 234

def initialize(dimension1, dimension1_hierarchy, dimension2, dimension2_hierarchy)
  @dimension1 = dimension1
  @dimension1_hierarchy = dimension1_hierarchy
  @dimension2 = dimension2
  @dimension2_hierarchy = dimension2_hierarchy
end

Instance Attribute Details

#dimension1Object (readonly)

Returns the value of attribute dimension1.



232
233
234
# File 'lib/active_warehouse/aggregate.rb', line 232

def dimension1
  @dimension1
end

#dimension1_hierarchyObject (readonly)

Returns the value of attribute dimension1_hierarchy.



232
233
234
# File 'lib/active_warehouse/aggregate.rb', line 232

def dimension1_hierarchy
  @dimension1_hierarchy
end

#dimension2Object (readonly)

Returns the value of attribute dimension2.



232
233
234
# File 'lib/active_warehouse/aggregate.rb', line 232

def dimension2
  @dimension2
end

#dimension2_hierarchyObject (readonly)

Returns the value of attribute dimension2_hierarchy.



232
233
234
# File 'lib/active_warehouse/aggregate.rb', line 232

def dimension2_hierarchy
  @dimension2_hierarchy
end

Instance Method Details

#==(o) ⇒ Object



241
242
243
# File 'lib/active_warehouse/aggregate.rb', line 241

def ==(o)
  o.instance_of?(self.class) and (o.to_s == to_s or o.to_s = to_rs)
end

#hashObject



245
246
247
# File 'lib/active_warehouse/aggregate.rb', line 245

def hash
  to_s.hash
end

#to_rsObject

Return the “reveresed” version of this key String representation



254
255
256
# File 'lib/active_warehouse/aggregate.rb', line 254

def to_rs
  "#{@dimension2}.#{@dimension2_hierarchy}.#{@dimension1}.#{@dimension1_hierarchy}"
end

#to_sObject



249
250
251
# File 'lib/active_warehouse/aggregate.rb', line 249

def to_s
  "#{@dimension1}.#{@dimension1_hierarchy}.#{@dimension2}.#{@dimension2_hierarchy}"
end