Class: Entitlement::DomainsEntry
- Defined in:
- lib/entitlement/domains_entry.rb
Overview
Docs
Instance Attribute Summary
Attributes inherited from Entry
Instance Method Summary collapse
-
#initialize(modules, from, to, filename_string, domains, &proc) ⇒ DomainsEntry
constructor
A new instance of DomainsEntry.
- #inspect ⇒ Object
- #valid?(module_name, resources = nil) ⇒ Boolean
- #valid_domain?(domain) ⇒ Boolean
Methods inherited from Entry
#days_left, #expiring?, #notify_if_expiring, #purgable?
Constructor Details
#initialize(modules, from, to, filename_string, domains, &proc) ⇒ DomainsEntry
Returns a new instance of DomainsEntry.
12 13 14 15 |
# File 'lib/entitlement/domains_entry.rb', line 12 def initialize(modules, from, to, filename_string, domains, &proc) super(modules, from, to, filename_string, &proc) @domains = Array[domains].flatten end |
Instance Method Details
#inspect ⇒ Object
22 23 24 25 |
# File 'lib/entitlement/domains_entry.rb', line 22 def inspect super puts "For domains : #{@domains.join(',')}" end |
#valid?(module_name, resources = nil) ⇒ Boolean
17 18 19 20 |
# File 'lib/entitlement/domains_entry.rb', line 17 def valid?(module_name, resources = nil) Puppet.debug 'Found a domain entitlement....' super ? valid_domain?(current_domain) : false end |
#valid_domain?(domain) ⇒ Boolean
27 28 29 30 31 32 33 34 35 |
# File 'lib/entitlement/domains_entry.rb', line 27 def valid_domain?(domain) @domains.any? do |entitled_domain| if entitled_domain.is_a?(String) domain == entitled_domain else domain.scan(entitled_domain).any? end end end |