Class: Clickwrap::RetentionClass::Rule
- Inherits:
-
Data
- Object
- Data
- Clickwrap::RetentionClass::Rule
- 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
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#host_event_name ⇒ Object
readonly
Returns the value of attribute host_event_name.
-
#indefinite ⇒ Object
readonly
Returns the value of attribute indefinite.
-
#part ⇒ Object
readonly
Returns the value of attribute part.
Instance Method Summary collapse
- #duration? ⇒ Boolean
- #host_event? ⇒ Boolean
- #indefinite? ⇒ Boolean
-
#initialize(part:, duration: nil, host_event_name: nil, indefinite: false) ⇒ Rule
constructor
A new instance of Rule.
- #to_snapshot ⇒ Object
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
#duration ⇒ Object (readonly)
Returns the value of attribute duration
32 33 34 |
# File 'lib/clickwrap/retention_class.rb', line 32 def duration @duration end |
#host_event_name ⇒ Object (readonly)
Returns the value of attribute host_event_name
32 33 34 |
# File 'lib/clickwrap/retention_class.rb', line 32 def host_event_name @host_event_name end |
#indefinite ⇒ Object (readonly)
Returns the value of attribute indefinite
32 33 34 |
# File 'lib/clickwrap/retention_class.rb', line 32 def indefinite @indefinite end |
#part ⇒ Object (readonly)
Returns the value of attribute part
32 33 34 |
# File 'lib/clickwrap/retention_class.rb', line 32 def part @part end |
Instance Method Details
#duration? ⇒ Boolean
37 |
# File 'lib/clickwrap/retention_class.rb', line 37 def duration? = !duration.nil? |
#host_event? ⇒ Boolean
38 |
# File 'lib/clickwrap/retention_class.rb', line 38 def host_event? = !host_event_name.nil? |
#indefinite? ⇒ Boolean
39 |
# File 'lib/clickwrap/retention_class.rb', line 39 def indefinite? = indefinite |
#to_snapshot ⇒ Object
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 |