Class: Jumbotron::Adapters::PolicyDefinition

Inherits:
Data
  • Object
show all
Defined in:
app/adapters/jumbotron/adapters/policy_definition.rb

Overview

Frozen registry entry for one adapter-declared update policy. Not a Policy base class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cadenceObject (readonly)

Returns the value of attribute cadence

Returns:

  • (Object)

    the current value of cadence



6
7
8
# File 'app/adapters/jumbotron/adapters/policy_definition.rb', line 6

def cadence
  @cadence
end

#eligibleObject (readonly)

Returns the value of attribute eligible

Returns:

  • (Object)

    the current value of eligible



6
7
8
# File 'app/adapters/jumbotron/adapters/policy_definition.rb', line 6

def eligible
  @eligible
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



6
7
8
# File 'app/adapters/jumbotron/adapters/policy_definition.rb', line 6

def id
  @id
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



6
7
8
# File 'app/adapters/jumbotron/adapters/policy_definition.rb', line 6

def type
  @type
end

Instance Method Details

#eligible?(game, now:) ⇒ Boolean

Returns:

  • (Boolean)

Raises:



7
8
9
10
11
# File 'app/adapters/jumbotron/adapters/policy_definition.rb', line 7

def eligible?(game, now:)
  raise ::Jumbotron::Adapters::ConfigurationError, "policy #{id} has no eligible predicate" if eligible.nil?

  eligible.call(game, now: now)
end