class Yome::Chip
Attributes
content[R]
end_index[R]
index[R]
kind[R]
path[R]
priority[R]
Public Class Methods
new(line, path, index)
click to toggle source
# File lib/yome/chip.rb, line 10 def initialize(line, path, index) @kind, @content = line.scan(/YOME:([\w.,]*) *(.*)/)[0] @path = path @index = index if @kind == "" @kind = "text" else # section? begin @priority = Float(@kind) @kind = "section" rescue ArgumentError end end end
Public Instance Methods
has_src?()
click to toggle source
# File lib/yome/chip.rb, line 50 def has_src? index < end_index end
parse(parser)
click to toggle source
# File lib/yome/chip.rb, line 27 def parse(parser) file = parser.file_hash[path] i = index + 1 while i < file.length do if file[i] =~ /YOME:([\w.,]*) *(.*)/ truncate_using_end = true if $1 == "end" break end i += 1 end @end_index = i - 1 unless truncate_using_end @end_index = [end_index, index + 8].min end while file[end_index] =~ /^\s*$/ @end_index -= 1 end end