Class: BambooRat::ComponentTree
- Inherits:
-
Object
- Object
- BambooRat::ComponentTree
- Defined in:
- lib/bamboo_rat/component_tree.rb
Instance Attribute Summary collapse
-
#components ⇒ Object
readonly
Returns the value of attribute components.
-
#js_components ⇒ Object
readonly
Returns the value of attribute js_components.
-
#ruby_components ⇒ Object
readonly
Returns the value of attribute ruby_components.
Instance Method Summary collapse
-
#initialize(path) ⇒ ComponentTree
constructor
A new instance of ComponentTree.
- #map_components ⇒ Object
Constructor Details
#initialize(path) ⇒ ComponentTree
Returns a new instance of ComponentTree.
5 6 7 8 9 10 11 |
# File 'lib/bamboo_rat/component_tree.rb', line 5 def initialize(path) @path = path @ruby_components = Set.new @js_components = Set.new @components = map_components self end |
Instance Attribute Details
#components ⇒ Object (readonly)
Returns the value of attribute components.
3 4 5 |
# File 'lib/bamboo_rat/component_tree.rb', line 3 def components @components end |
#js_components ⇒ Object (readonly)
Returns the value of attribute js_components.
3 4 5 |
# File 'lib/bamboo_rat/component_tree.rb', line 3 def js_components @js_components end |
#ruby_components ⇒ Object (readonly)
Returns the value of attribute ruby_components.
3 4 5 |
# File 'lib/bamboo_rat/component_tree.rb', line 3 def ruby_components @ruby_components end |
Instance Method Details
#map_components ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bamboo_rat/component_tree.rb', line 13 def map_components folders = Dir[File.join(@path, '/*/*')].select do |entry| File.directory? entry end folders.each do |path| @ruby_components << RubyComponent.new(path) if RubyComponent.ruby?(path) @js_components << JSComponent.new(path) if JSComponent.js?(path) end @ruby_components + @js_components end |