Class: Textus::Domain::Policy::Promote
- Inherits:
-
Object
- Object
- Textus::Domain::Policy::Promote
- Defined in:
- lib/textus/domain/policy/promote.rb
Constant Summary collapse
- KNOWN =
%i[schema_valid human_accept].freeze
Instance Attribute Summary collapse
-
#requires ⇒ Object
readonly
Returns the value of attribute requires.
Instance Method Summary collapse
- #demands?(req) ⇒ Boolean
-
#initialize(requires:) ⇒ Promote
constructor
A new instance of Promote.
Constructor Details
#initialize(requires:) ⇒ Promote
Returns a new instance of Promote.
8 9 10 11 12 13 14 15 16 |
# File 'lib/textus/domain/policy/promote.rb', line 8 def initialize(requires:) syms = Array(requires).map { |r| r.to_s.to_sym } unknown = syms - KNOWN unless unknown.empty? raise Textus::UsageError.new("unknown promote requirement: #{unknown.first.inspect} (known: #{KNOWN.join(", ")})") end @requires = syms end |
Instance Attribute Details
#requires ⇒ Object (readonly)
Returns the value of attribute requires.
6 7 8 |
# File 'lib/textus/domain/policy/promote.rb', line 6 def requires @requires end |
Instance Method Details
#demands?(req) ⇒ Boolean
18 19 20 |
# File 'lib/textus/domain/policy/promote.rb', line 18 def demands?(req) @requires.include?(req) end |