Class: Waffle::Maker::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/waffle/maker.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Filter

Returns a new instance of Filter.



30
31
32
33
34
35
36
37
38
39
# File 'lib/waffle/maker.rb', line 30

def initialize(argv)
  (@options = Waffle::Maker::Config.default_options).tap do |options|
    OptionParser.new { |o|
      o.banner = "Usage: #{$0}"
      o.on("-f number", "Column number that contains the rails path") { |v| options[:f] << v.to_i }
      o.on("-w number", "Column number that contains the waf path") { |v| options[:w] << v.to_i }
      o.on("--silent-error", "Hide parsing errors, default is false") { |v| options[:silent_error] << v }
    }.parse!(argv)
  end
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



22
23
24
# File 'lib/waffle/maker.rb', line 22

def options
  @options
end

Class Method Details

.executeObject



25
26
27
# File 'lib/waffle/maker.rb', line 25

def execute
  Waffle::Maker::Filter.new(ARGV.dup).execute
end

Instance Method Details

#executeObject



41
42
43
44
45
# File 'lib/waffle/maker.rb', line 41

def execute
  wafs.each do |waf|
    puts waf[:raw] if Waffle::Maker::Matcher.new(waf[:path], routes).matched?
  end
end