Class: CFBundle::Resource::Predicate
- Inherits:
-
Object
- Object
- CFBundle::Resource::Predicate
- Defined in:
- lib/cfbundle/resource.rb
Overview
Stores the parameters to select the matching resources while enumerating the resources of a bundle.
Instance Attribute Summary collapse
-
#extension ⇒ String?
readonly
Returns the extension to match or
nilto match any extension. -
#name ⇒ String?, Regexp?
readonly
Returns the name to match or
nilto match any name. -
#product ⇒ String
readonly
Returns the product to match.
Instance Method Summary collapse
-
#initialize(name, extension, product) ⇒ Predicate
constructor
A new instance of Predicate.
-
#uniq?(name, extension) ⇒ Boolean
Ensures the given name and extension are unique during the enumeration.
Constructor Details
#initialize(name, extension, product) ⇒ Predicate
Returns a new instance of Predicate.
175 176 177 178 179 180 |
# File 'lib/cfbundle/resource.rb', line 175 def initialize(name, extension, product) @name = name @extension = extension_for(extension) @product = product_for(product) @keys = Set.new end |
Instance Attribute Details
#extension ⇒ String? (readonly)
Returns the extension to match or nil to match any extension.
164 165 166 |
# File 'lib/cfbundle/resource.rb', line 164 def extension @extension end |
#name ⇒ String?, Regexp? (readonly)
Returns the name to match or nil to match any name.
160 161 162 |
# File 'lib/cfbundle/resource.rb', line 160 def name @name end |
#product ⇒ String (readonly)
Returns the product to match.
168 169 170 |
# File 'lib/cfbundle/resource.rb', line 168 def product @product end |
Instance Method Details
#uniq?(name, extension) ⇒ Boolean
Ensures the given name and extension are unique during the enumeration.
186 187 188 189 190 191 |
# File 'lib/cfbundle/resource.rb', line 186 def uniq?(name, extension) key = [name, extension].join return false if @keys.include?(key) @keys << key true end |