Class: Pars
- Inherits:
-
Object
- Object
- Pars
- Defined in:
- lib/pars.rb
Class Method Summary collapse
- .anyPost? ⇒ Boolean
- .directory_hash(path, name = nil) ⇒ Object
- .generate ⇒ Object
- .isParsDir? ⇒ Boolean
Class Method Details
.anyPost? ⇒ Boolean
15 16 17 18 19 20 21 |
# File 'lib/pars.rb', line 15 def self.anyPost? if File.exist?(Dir.pwd + "/posts") then true else false end end |
.directory_hash(path, name = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pars.rb', line 23 def self.directory_hash(path, name=nil) data = {:data => (name || path)} data[:children] = children = [] Dir.foreach(path) do |entry| next if (entry == '..' || entry == '.') full_path = File.join(path, entry) if File.directory?(full_path) children << directory_hash(full_path, entry) else children << entry end end return data end |
.generate ⇒ Object
44 45 46 47 48 |
# File 'lib/pars.rb', line 44 def self.generate Dir.glob(Dir.pwd + "/posts/" + "*.md") do |doc| puts doc end end |
.isParsDir? ⇒ Boolean
7 8 9 10 11 12 13 |
# File 'lib/pars.rb', line 7 def self.isParsDir? if File.exist?(".pars.yml") then true else false end end |