Class: Duxml::Doc
- Includes:
- ElementGuts
- Defined in:
- lib/duxml/doc.rb
Instance Attribute Summary collapse
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#path ⇒ Object
Returns the value of attribute path.
Attributes included from Reportable
Attributes included from Duxml
Attributes included from Saxer
Instance Method Summary collapse
- #<<(obj) ⇒ Object
-
#description ⇒ String
One word description of what this object is: ‘document’.
-
#grammar ⇒ Object
shortcut method @see Meta#grammar.
-
#grammar=(grammar_or_file) ⇒ Object
shortcut method @see Meta#grammar=.
-
#history ⇒ Object
shortcut method @see Meta#history.
-
#initialize(prolog = {}) ⇒ Doc
constructor
A new instance of Doc.
-
#set_meta(path_or_obj = nil) ⇒ Doc
Self.
-
#to_s ⇒ String
Summary of XML document as Ruby object and description of root element.
-
#write_to(path) ⇒ Doc
Returns self after writing contents to file.
Methods included from ElementGuts
#[], #[]=, #abstract?, #add, #dclone, #delete, #each, #inspect, #name_space, #sclone, #set_doc!, #stub, #text?, #traverse
Methods included from LazyOx
Methods included from Reportable
Methods included from Duxml
Methods included from Saxer
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Duxml::LazyOx
Instance Attribute Details
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
16 17 18 |
# File 'lib/duxml/doc.rb', line 16 def @meta end |
#path ⇒ Object
Returns the value of attribute path.
16 17 18 |
# File 'lib/duxml/doc.rb', line 16 def path @path end |
Instance Method Details
#<<(obj) ⇒ Object
84 85 86 87 88 |
# File 'lib/duxml/doc.rb', line 84 def <<(obj) super(obj) obj.set_doc! self self end |
#description ⇒ String
Returns one word description of what this object is: ‘document’.
70 71 72 |
# File 'lib/duxml/doc.rb', line 70 def description 'document' end |
#grammar ⇒ Object
shortcut method @see Meta#grammar
55 56 57 |
# File 'lib/duxml/doc.rb', line 55 def grammar .grammar end |
#grammar=(grammar_or_file) ⇒ Object
shortcut method @see Meta#grammar=
60 61 62 |
# File 'lib/duxml/doc.rb', line 60 def grammar=(grammar_or_file) .grammar = grammar_or_file end |
#history ⇒ Object
shortcut method @see Meta#history
65 66 67 |
# File 'lib/duxml/doc.rb', line 65 def history .history end |
#set_meta(path_or_obj = nil) ⇒ Doc
Returns self.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/duxml/doc.rb', line 42 def (path_or_obj=nil) @meta = case path_or_obj when MetaClass, Element then path_or_obj when String && File.exists?(path_or_obj) Ox.parse_obj(path_or_obj) else File.write(Meta.(path), Ox.dump()) if path end self end |