Class: Pigtail::Output::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/pigtail/output_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = nil, configure = nil) ⇒ Config

Returns a new instance of Config.



6
7
8
9
# File 'lib/pigtail/output_config.rb', line 6

def initialize(path = nil, configure = nil)
  @path      = path
  @configure = configure
end

Instance Attribute Details

#configureObject

Returns the value of attribute configure.



4
5
6
# File 'lib/pigtail/output_config.rb', line 4

def configure
  @configure
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/pigtail/output_config.rb', line 4

def path
  @path
end

Class Method Details

.enumerate(item) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/pigtail/output_config.rb', line 11

def self.enumerate(item)
  if item and item.is_a?(String)
    items = item.split(',')
  else
    items = item
    items = [items] unless items and items.respond_to?(:each)
  end
  items
end

.output(paths, config) ⇒ Object



21
22
23
24
25
# File 'lib/pigtail/output_config.rb', line 21

def self.output(paths, config)
  enumerate(paths).each do |path|
    yield new(path, config.output).output
  end
end

Instance Method Details

#outputObject



27
28
29
# File 'lib/pigtail/output_config.rb', line 27

def output
  { path: @path, configure: @configure }
end