Class: Clickwrap::RetentionClass::Rule

Inherits:
Data
  • Object
show all
Defined in:
lib/clickwrap/retention_class.rb

Overview

A rule is either a duration from the event's server-recorded time, or the name of a host-registered calculation that may depend on domain state and may not be resolvable yet.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(part:, duration: nil, host_event_name: nil) ⇒ Rule

Returns a new instance of Rule.



28
29
30
# File 'lib/clickwrap/retention_class.rb', line 28

def initialize(part:, duration: nil, host_event_name: nil)
  super
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration

Returns:

  • (Object)

    the current value of duration



27
28
29
# File 'lib/clickwrap/retention_class.rb', line 27

def duration
  @duration
end

#host_event_nameObject (readonly)

Returns the value of attribute host_event_name

Returns:

  • (Object)

    the current value of host_event_name



27
28
29
# File 'lib/clickwrap/retention_class.rb', line 27

def host_event_name
  @host_event_name
end

#partObject (readonly)

Returns the value of attribute part

Returns:

  • (Object)

    the current value of part



27
28
29
# File 'lib/clickwrap/retention_class.rb', line 27

def part
  @part
end

Instance Method Details

#duration?Boolean

Returns:

  • (Boolean)


32
# File 'lib/clickwrap/retention_class.rb', line 32

def duration? = !duration.nil?

#host_event?Boolean

Returns:

  • (Boolean)


33
# File 'lib/clickwrap/retention_class.rb', line 33

def host_event? = !host_event_name.nil?

#to_snapshotObject



35
36
37
# File 'lib/clickwrap/retention_class.rb', line 35

def to_snapshot
  { "duration_seconds" => duration&.to_i, "host_event" => host_event_name&.to_s }.compact
end