class Datasets::LIBSVMDatasetList::DescriptionListener

Public Class Methods

new(abort_tag, description) click to toggle source
# File lib/datasets/libsvm-dataset-list.rb, line 243
def initialize(abort_tag, description)
  @abort_tag = abort_tag
  @description = description
  @in_content = false
  @p = nil
end

Public Instance Methods

tag_end(name) click to toggle source
# File lib/datasets/libsvm-dataset-list.rb, line 263
def tag_end(name)
  case name
  when "p"
    @description << @p.join(" ")
  end
end
tag_start(name, attributes) click to toggle source
# File lib/datasets/libsvm-dataset-list.rb, line 250
def tag_start(name, attributes)
  case name
  when "p"
    @in_content = true
    @p = []
  when "br"
    @description << @p.join(" ")
    @p = []
  when "hr"
    throw(@abort_tag)
  end
end
text(data) click to toggle source
# File lib/datasets/libsvm-dataset-list.rb, line 270
def text(data)
  return unless @in_content
  content = data.gsub(/[ \t\n]+/, " ").strip
  @p << content unless content.empty?
end