Module: CbetaShare

Instance Method Summary collapse

Instance Method Details

#each_canon(xml_root) ⇒ Object



2
3
4
5
6
7
# File 'lib/cbeta/cbeta_share.rb', line 2

def each_canon(xml_root)
  Dir.entries(xml_root).sort.each do |c|
    next unless c.match(/^#{CBETA::CANON}$/)
    yield(c)
  end
end

#to_html(e) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/cbeta/cbeta_share.rb', line 9

def to_html(e)
  e.to_xml(
    encoding: 'UTF-8',
    save_with: Nokogiri::XML::Node::SaveOptions::AS_XML |
               Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS
  )
end