Module: Duxml::Meta
Constant Summary collapse
- FILE_EXT =
'.duxml'
Class Method Summary collapse
-
.meta_path(path) ⇒ String
Full path of metadata file based on content file’s name e.g.
-
.xml ⇒ Doc
Metadata document.
Instance Method Summary collapse
Class Method Details
.meta_path(path) ⇒ String
Returns full path of metadata file based on content file’s name e.g. ‘design.xml’ => ‘.design.xml.duxml’.
39 40 41 42 |
# File 'lib/duxml/meta.rb', line 39 def self.(path) dir = File.dirname(path) "#{dir}/.#{File.basename(path)}#{FILE_EXT}" end |
.xml ⇒ Doc
Returns metadata document.
30 31 32 33 34 |
# File 'lib/duxml/meta.rb', line 30 def self.xml d = Doc.new << (Element.new(name.nmtokenize) << Grammar.xml << History.xml) d.root.grammar[:ref] = @grammar_path if @grammar_path d end |
Instance Method Details
#grammar=(g) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/duxml/meta.rb', line 44 def grammar=(g) @grammar = g.is_a?(GrammarClass) ? g : Grammar.import(g) history.delete_observers if history.respond_to?(:delete_observers) history.add_observer(grammar, :qualify) grammar.add_observer history end |