Class: YJCocoa::Unused

Inherits:
Command
  • Object
show all
Defined in:
lib/yjcocoa/unused/unused.rb

Overview

Usage

Direct Known Subclasses

UnusedClass, UnusedImage, UnusedMethod

Constant Summary

Constants inherited from Command

Command::DEFAULT_OPTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#askWithAnswers, options

Constructor Details

#initialize(argv) ⇒ Unused

初始化



29
30
31
32
33
34
35
36
37
38
# File 'lib/yjcocoa/unused/unused.rb', line 29

def initialize(argv)
    super
    self.matcho = argv.option('match-o')
    self.match = argv.option('match')
    self.match = self.match.split(",").reject {|i| i.empty? } if self.match
    self.ignore = argv.option('ignore')
    self.ignore = self.ignore.split(",").reject {|i| i.empty? } if self.ignore
    self.output = argv.option('output')
    self.output = Dir.pwd + "/YJCocoa.h" unless self.output
end

Instance Attribute Details

#ignoreObject

Returns the value of attribute ignore.



25
26
27
# File 'lib/yjcocoa/unused/unused.rb', line 25

def ignore
  @ignore
end

#matchObject

Returns the value of attribute match.



24
25
26
# File 'lib/yjcocoa/unused/unused.rb', line 24

def match
  @match
end

#matchoObject

property



23
24
25
# File 'lib/yjcocoa/unused/unused.rb', line 23

def matcho
  @matcho
end

#outputObject

Returns the value of attribute output.



26
27
28
# File 'lib/yjcocoa/unused/unused.rb', line 26

def output
  @output
end

Instance Method Details

#check_ignore(item) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/yjcocoa/unused/unused.rb', line 48

def check_ignore(item)
    return false unless self.ignore
    self.ignore.each { |i|
        return true if item.include?(i)
    }
    return false
end

#check_match(item) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/yjcocoa/unused/unused.rb', line 40

def check_match(item)
    return true unless self.match
    self.match.each { |m|
        return true if item.include?(m)
    }
    return false
end