Class: LoadDir
- Inherits:
-
Object
- Object
- LoadDir
- Defined in:
- lib/load_dir.rb
Direct Known Subclasses
Constant Summary collapse
- HTML_PATH =
Dir.pwd + '/app/views'
- CSS_PATH =
Dir.pwd + '/app/assets/stylesheets'
- CSS_MAIN_PATH =
Dir.pwd + '/app/assets/stylesheets/base'
Instance Attribute Summary collapse
-
#directories ⇒ Object
Returns the value of attribute directories.
-
#files ⇒ Object
Returns the value of attribute files.
Instance Method Summary collapse
- #css_files(dir) ⇒ Object
- #dir_iteration ⇒ Object
- #html_files(dir) ⇒ Object
-
#initialize(*args) ⇒ LoadDir
constructor
A new instance of LoadDir.
- #layout_files(dir) ⇒ Object
Constructor Details
#initialize(*args) ⇒ LoadDir
Returns a new instance of LoadDir.
9 10 11 12 13 |
# File 'lib/load_dir.rb', line 9 def initialize(*args) @directories = args.flatten @files = {} dir_iteration end |
Instance Attribute Details
#directories ⇒ Object
Returns the value of attribute directories.
7 8 9 |
# File 'lib/load_dir.rb', line 7 def directories @directories end |
#files ⇒ Object
Returns the value of attribute files.
7 8 9 |
# File 'lib/load_dir.rb', line 7 def files @files end |
Instance Method Details
#css_files(dir) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/load_dir.rb', line 37 def css_files dir #Dir.foreach methods arg is only the base dir Dir.foreach(CSS_PATH) do |file| self.files[file] = CSS_PATH if /(#{dir}|application)/.match(file) end Dir.foreach(CSS_MAIN_PATH) do |file| self.files[file] = CSS_MAIN_PATH if /(#{dir}|application)/.match(file) end end |
#dir_iteration ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/load_dir.rb', line 15 def dir_iteration @directories.each do |dir| html_files(dir) layout_files(dir) css_files(dir) end end |