Class: RubiGen::PathFilteredSource
- Inherits:
-
PathSource
- Object
- Source
- PathSource
- RubiGen::PathFilteredSource
- Defined in:
- lib/rubigen/lookup.rb
Instance Attribute Summary collapse
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
Attributes inherited from PathSource
Attributes inherited from Source
Instance Method Summary collapse
- #==(source) ⇒ Object
- #filter_str(filters) ⇒ Object
-
#initialize(label, path, *filters) ⇒ PathFilteredSource
constructor
A new instance of PathFilteredSource.
Methods inherited from PathSource
Methods inherited from Source
Constructor Details
#initialize(label, path, *filters) ⇒ PathFilteredSource
Returns a new instance of PathFilteredSource.
238 239 240 |
# File 'lib/rubigen/lookup.rb', line 238 def initialize(label, path, *filters) super label, File.join(path, "#{filter_str(filters)}generators") end |
Instance Attribute Details
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
236 237 238 |
# File 'lib/rubigen/lookup.rb', line 236 def filters @filters end |
Instance Method Details
#==(source) ⇒ Object
250 251 252 |
# File 'lib/rubigen/lookup.rb', line 250 def ==(source) self.class == source.class && path == source.path && filters == source.filters && label == source.label end |
#filter_str(filters) ⇒ Object
242 243 244 245 246 247 248 |
# File 'lib/rubigen/lookup.rb', line 242 def filter_str(filters) @filters = filters.first.is_a?(Array) ? filters.first : filters return "" if @filters.blank? filter_str = @filters.map {|filter| "#{filter}_"}.join(",") filter_str += "," "{#{filter_str}}" end |