Class: Clickwrap::RetentionClass::Rule

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Rule.



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

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

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration

Returns:

  • (Object)

    the current value of duration



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

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



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

def host_event_name
  @host_event_name
end

#indefiniteObject (readonly)

Returns the value of attribute indefinite

Returns:

  • (Object)

    the current value of indefinite



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

def indefinite
  @indefinite
end

#partObject (readonly)

Returns the value of attribute part

Returns:

  • (Object)

    the current value of part



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

def part
  @part
end

Instance Method Details

#duration?Boolean

Returns:

  • (Boolean)


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

def duration? = !duration.nil?

#host_event?Boolean

Returns:

  • (Boolean)


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

def host_event? = !host_event_name.nil?

#indefinite?Boolean

Returns:

  • (Boolean)


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

def indefinite? = indefinite

#to_snapshotObject



41
42
43
44
45
46
47
# File 'lib/clickwrap/retention_class.rb', line 41

def to_snapshot
  {
    "duration_seconds" => duration&.to_i,
    "host_event" => host_event_name&.to_s,
    "indefinite" => (true if indefinite)
  }.compact
end