class Syobocal::Comment::Element::Row
Attributes
attr_node[R]
value_node[R]
Public Class Methods
match?(line)
click to toggle source
# File lib/syobocal/comment/element/row.rb, line 15 def self.match?(line) line.start_with?(":") end
new(attr_node, value_node)
click to toggle source
# File lib/syobocal/comment/element/row.rb, line 7 def initialize(attr_node, value_node) @attr_node, @value_node = attr_node, value_node end
parse(line)
click to toggle source
# File lib/syobocal/comment/element/row.rb, line 19 def self.parse(line) if line.scan(":").length == 1 # NOTE :が1つしか含まれない行は:以降が値となる m = line.match(/\A:(.*)\Z/) attr = Element::Blank.new value = Element::TextNode.parse(m[1]) else m = line.match(/\A:([^:]*?):(.*)\Z/) attr = Element::TextNode.parse(m[1]) value = Element::TextNode.parse(m[2]) end Element::Row.new(attr, value) end
Public Instance Methods
==(other)
click to toggle source
# File lib/syobocal/comment/element/row.rb, line 11 def ==(other) other.instance_of?(self.class) && other.attr_node == attr_node && other.value_node == value_node end