class Mexico::FileSystem::Entry
This class provides a corpus representation that is backed up by the filesystem. A central Corpus definition file in the top-level folder contains an XML representation of the corpus structure, and all actual resources are found as files on a file system reachable from the top-level folder.
Attributes
values[RW]
Public Class Methods
from_xml(node, args={})
click to toggle source
# File lib/mexico/file_system/entry.rb, line 36 def self.from_xml(node, args={}) @values = {} node.elements.each do |el| key = el['key'] val = el.text @values[key] = val end end
Public Instance Methods
to_xml(params = {})
click to toggle source
# File lib/mexico/file_system/entry.rb, line 45 def to_xml(params = {}) params.reverse_merge!(:name => self.class.tag_name, :namespace => self.class.roxml_namespace) params[:namespace] = nil if ['*', 'xmlns'].include?(params[:namespace]) node = XML.new_node([params[:namespace], params[:name]].compact.join(':')).tap do |root| @values.each do |k,v| root.children << XML.new_node([params[:namespace], 'Entry']).tap do |ent| ent['key'] = k ent.text = v end end end node end