Class: MemoRack::PageInfoOrg
- Defined in:
- lib/memorack/plugins/formats/org.rb
Instance Attribute Summary
Attributes inherited from PageInfo
Class Method Summary collapse
Instance Method Summary collapse
- #accept_date(line, prev = nil) ⇒ Object
- #org_info(name, line) ⇒ Object
-
#parse_end?(line, n) ⇒ Boolean
ファイル解析の終了か?.
Methods inherited from PageInfo
#app, define_keys, #git?, #initialize, #log, #parse, #value_to_time, #values
Methods included from Plugin
#<=>, #[], #extnames, #inherited, #member?, #plugins, #priority
Methods inherited from Locals
#[], #context, #context=, define_key, #define_key, #has_key?, #merge, #super_has_key?, #value, value_method, #value_method?
Constructor Details
This class inherits a constructor from MemoRack::PageInfo
Class Method Details
.extnames ⇒ Object
ファイル拡張子
14 15 16 |
# File 'lib/memorack/plugins/formats/org.rb', line 14 def self.extnames ['org'] end |
.org_keys(*keys, &block) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/memorack/plugins/formats/org.rb', line 18 def self.org_keys(*keys, &block) define_keys *keys keys.each { |name| block = lambda { |line, prev = nil| org_info(name, line) } define_method("accept_#{name}", &block) } end |
Instance Method Details
#accept_date(line, prev = nil) ⇒ Object
40 41 42 43 44 |
# File 'lib/memorack/plugins/formats/org.rb', line 40 def accept_date(line, prev = nil) value = org_info(:date, line) value = Time.parse(value) if value value end |
#org_info(name, line) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/memorack/plugins/formats/org.rb', line 32 def org_info(name, line) name = name.to_s.upcase if line =~ /^\#\+#{name}:\s*(.+)$/ $1.strip end end |
#parse_end?(line, n) ⇒ Boolean
ファイル解析の終了か?
28 29 30 |
# File 'lib/memorack/plugins/formats/org.rb', line 28 def parse_end?(line, n) line !~ /^\#/ end |