Class: Activecube::Processor::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/activecube/processor/index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, *args) ⇒ Index

Returns a new instance of Index.



6
7
8
9
# File 'lib/activecube/processor/index.rb', line 6

def initialize name, *args
  @fields = [name].flatten
  @cardinality = args.first && args.first[:cardinality]
end

Instance Attribute Details

#cardinalityObject (readonly)

Returns the value of attribute cardinality.



5
6
7
# File 'lib/activecube/processor/index.rb', line 5

def cardinality
  @cardinality
end

#fieldsObject (readonly)

Returns the value of attribute fields.



5
6
7
# File 'lib/activecube/processor/index.rb', line 5

def fields
  @fields
end

Instance Method Details

#indexes?(query, measures) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/activecube/processor/index.rb', line 11

def indexes? query, measures
  (fields - query.selector_column_names(measures)).empty?
end