Class: Druid::Dimension

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/druid/dimension.rb

Defined Under Namespace

Classes: ExtractionFnValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Dimension

Returns a new instance of Dimension.



28
29
30
31
32
33
34
# File 'lib/druid/dimension.rb', line 28

def initialize(params)
  if params.is_a?(Hash)
    super
  else
    super(type: 'default', dimension: params.to_s, outputName: params.to_s)
  end
end

Instance Attribute Details

#dimensionObject

Returns the value of attribute dimension.



8
9
10
# File 'lib/druid/dimension.rb', line 8

def dimension
  @dimension
end

#extractionFnObject

Returns the value of attribute extractionFn.



25
26
27
# File 'lib/druid/dimension.rb', line 25

def extractionFn
  @extractionFn
end

#outputNameObject

Returns the value of attribute outputName.



11
12
13
# File 'lib/druid/dimension.rb', line 11

def outputName
  @outputName
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/druid/dimension.rb', line 5

def type
  @type
end

Class Method Details

.lookup(dimension, namespace, outputName: nil, retain: true, injective: false) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/druid/dimension.rb', line 40

def self.lookup(dimension, namespace, outputName: nil, retain: true, injective: false)
  new({
    type: 'extraction',
    dimension: dimension,
    outputName: outputName || namespace,
    extractionFn: {
      type: 'registeredLookup',
      lookup: namespace,
      retainMissingValue: retain,
      injective: injective,
    },
  })
end

Instance Method Details

#as_json(options = {}) ⇒ Object



36
37
38
# File 'lib/druid/dimension.rb', line 36

def as_json(options = {})
  super(options.merge(except: %w(errors validation_context)))
end