Class: Kuhsaft::PartialExtractor
- Inherits:
-
Object
- Object
- Kuhsaft::PartialExtractor
- Defined in:
- lib/kuhsaft/partial_extractor.rb
Instance Method Summary collapse
- #collect_partials(path) ⇒ Object
- #extract_filenames(partial_paths) ⇒ Object
- #partials(path) ⇒ Object
Instance Method Details
#collect_partials(path) ⇒ Object
13 14 15 |
# File 'lib/kuhsaft/partial_extractor.rb', line 13 def collect_partials(path) extract_filenames(Dir.glob("#{Rails.root}#{path}")) end |
#extract_filenames(partial_paths) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/kuhsaft/partial_extractor.rb', line 3 def extract_filenames(partial_paths) partials = [] partial_paths.each do |partial| filename = File.basename(partial).split('.', 0).first filename.slice!(0) partials << filename end partials.collect {|d| [I18n.t(d), d]} end |
#partials(path) ⇒ Object
17 18 19 |
# File 'lib/kuhsaft/partial_extractor.rb', line 17 def partials(path) @partials = collect_partials(path) end |