Class: Fus::Finder
- Inherits:
-
Object
- Object
- Fus::Finder
- Defined in:
- lib/fus/finder.rb
Overview
The thing that finds the stuff
Instance Attribute Summary collapse
-
#swift_paths ⇒ Object
readonly
Returns the value of attribute swift_paths.
Instance Method Summary collapse
-
#initialize(path) ⇒ Finder
constructor
A new instance of Finder.
-
#swift_classnames ⇒ Object
A list of names of all Swift classes.
-
#unused_classnames ⇒ Object
A list of names of unused classes.
Constructor Details
#initialize(path) ⇒ Finder
Returns a new instance of Finder.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/fus/finder.rb', line 6 def initialize(path) raise Errno::ENOENT.new(path) unless Dir.exists?(path) path = File.(path) @swift_paths = Dir .glob("#{path}/**/*.swift") .select {|path| path.scan(/\/Pods\//).empty? } .select {|path| path.scan(/\/Carthage\//).empty? } @obj_c_paths = Dir.glob("#{path}/**/*.m") + Dir.glob("#{path}/**/*.h") .select {|path| path.scan(/-Swift.h/).empty? } @ib_paths = (Dir.glob("#{path}/**/*.xib") + Dir.glob("#{path}/**/*.storyboard")) end |
Instance Attribute Details
#swift_paths ⇒ Object (readonly)
Returns the value of attribute swift_paths.
4 5 6 |
# File 'lib/fus/finder.rb', line 4 def swift_paths @swift_paths end |
Instance Method Details
#swift_classnames ⇒ Object
A list of names of all Swift classes
25 26 27 |
# File 'lib/fus/finder.rb', line 25 def swift_classnames swift_classes.map(&:name) end |
#unused_classnames ⇒ Object
A list of names of unused classes
20 21 22 |
# File 'lib/fus/finder.rb', line 20 def unused_classnames unused_classes.map(&:name) end |