Class: EventMeter::ReportDefinition::Interval

Inherits:
Struct
  • Object
show all
Defined in:
lib/event_meter/report_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(param:, group_by: []) ⇒ Interval

Returns a new instance of Interval.



23
24
25
26
27
28
# File 'lib/event_meter/report_definition.rb', line 23

def initialize(param:, group_by: [])
  super(
    param: ReportDefinition.normalize_param(param),
    group_by: ReportDefinition.normalize_params(group_by)
  )
end

Instance Attribute Details

#group_byObject

Returns the value of attribute group_by

Returns:

  • (Object)

    the current value of group_by



22
23
24
# File 'lib/event_meter/report_definition.rb', line 22

def group_by
  @group_by
end

#paramObject

Returns the value of attribute param

Returns:

  • (Object)

    the current value of param



22
23
24
# File 'lib/event_meter/report_definition.rb', line 22

def param
  @param
end

Instance Method Details

#group_indexObject



30
31
32
# File 'lib/event_meter/report_definition.rb', line 30

def group_index
  Index.new(params: group_by)
end

#to_hObject



34
35
36
37
38
39
# File 'lib/event_meter/report_definition.rb', line 34

def to_h
  {
    "param" => param.to_s,
    "group_by" => group_by.map(&:to_s)
  }
end