extreml 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +4 -99
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdf78f69900728ade56258357b59d0c265e3899cd75d815583013b6358eac773
|
4
|
+
data.tar.gz: 21efcdaeb00a7779b87fb7b6583f4d5c887b2c84cd4bc2139c7100cad0906062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90e4897a9ff69e52450e55d00ed6b5938ccc4a045358e40c485d23f8f0b357d20bba9ce21058760b82005f9ae9a283d6fb721c08c264bd13f31b1d14eb37d2ed
|
7
|
+
data.tar.gz: 9b1ace372adfe41199c644762fed6dc736c040116038d177fad79322ca46f4411280e8023f4ade3c874fc478bd5ac9c7f5073d023ce08c11487d764249442f29
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extreml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabio Boccacini
|
@@ -10,104 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
A powerful ruby gem to easily manipulate XML documents, that gives acces to the elements through dynamic methods.
|
18
|
-
|
19
|
-
This library contains another class, TypeElement, which exposes dynamic methods named after its nested tags.
|
20
|
-
|
21
|
-
The document method in of Extreml returns aTypeElement object with a method named after the root tag which returns the first level of nesting represented as TypeElement objects.
|
22
|
-
|
23
|
-
Any subsequent object has methods that reflect its structure, that return recursively an object that has the nested elements as methods.
|
24
|
-
|
25
|
-
If there are more than one element with the same tag, that method will return an array containing all subsequent objects.
|
26
|
-
|
27
|
-
All basic methods of TypeElement have aliases, in order to prevent method overriding in case the document contains tags with similar names, which are called with two leading underscores (es. __types).
|
28
|
-
|
29
|
-
|
30
|
-
Usage:
|
31
|
-
------
|
32
|
-
|
33
|
-
### Basic methods:
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
**Extreml:**
|
38
|
-
|
39
|
-
document: returns the representation of the entire document as a TypeElement object.
|
40
|
-
|
41
|
-
tree: prints the entire structure of the document for debugging purposes.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
**TypeElement:**
|
46
|
-
|
47
|
-
name: returns the name of the element (= tag name).
|
48
|
-
|
49
|
-
namespace: returns the namespace of the tag.
|
50
|
-
|
51
|
-
attributes: returns an hash with the property names as key and the values as value.
|
52
|
-
|
53
|
-
types: returns an array containing the names of the dynamic methods referring to the nested elements.
|
54
|
-
|
55
|
-
to_s: returns the content (overrides
|
56
|
-
tree: prints the structure referred part of the document for debugging purposes.
|
57
|
-
|
58
|
-
All these methods have aliases (eg. __name, __namespace, etc.)
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
**File example:**
|
63
|
-
funny_people.xml
|
64
|
-
|
65
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
66
|
-
<ns0:funnyPeople>
|
67
|
-
<ns1:businessCard>
|
68
|
-
<name>
|
69
|
-
<firstName>Guybrush</firstName>
|
70
|
-
<lastName>Threepwood</lastName>
|
71
|
-
</name>
|
72
|
-
<jobs:occupation name="pirate" description="Terror of threeheaded monkeys"/>
|
73
|
-
<address>
|
74
|
-
<island>Scabb Island</island>
|
75
|
-
<city>Pirate's city</city>
|
76
|
-
<street>Voodoo Blvd.</street>
|
77
|
-
<number>3</number>
|
78
|
-
</address>
|
79
|
-
</ns1:businessCard>
|
80
|
-
<ns1:businessCard>
|
81
|
-
<name>
|
82
|
-
<firstName>Senbei</firstName>
|
83
|
-
<lastName>Norimaki</lastName>
|
84
|
-
</name>
|
85
|
-
<jobs:occupation name="inventor" description="A great genius"/>
|
86
|
-
<address>
|
87
|
-
<city>Penguin Village</city>
|
88
|
-
<street>Tanuki doro</street>
|
89
|
-
<number>1</number>
|
90
|
-
</address>
|
91
|
-
</ns1:businessCard>
|
92
|
-
<types>
|
93
|
-
<type name="main character"/>
|
94
|
-
<type name="villain"/>
|
95
|
-
<otherTypes/>
|
96
|
-
</types>
|
97
|
-
</ns0:funnyPeople>
|
98
|
-
|
99
|
-
## Code example:
|
100
|
-
|
101
|
-
xml = Extreml.new './funny_people.xml'
|
102
|
-
|
103
|
-
xml.header.version # => "1.0"
|
104
|
-
xml.header.encoding # => "UTF-8"
|
105
|
-
|
106
|
-
xml.document.funnyPeople.businessCard[0].name.firstName.to_s # => Guybrush
|
107
|
-
xml.document.funnyPeople.businessCard[0].__name # => "businessCard"
|
108
|
-
|
109
|
-
xml.document.funnyPeople.types # => #<TypeElement:0x0000557373082fc8>
|
110
|
-
xml.document.funnyPeople.__types # => [:businessCard, :types]
|
13
|
+
description: |-
|
14
|
+
This gem allows to read an XML file and access its elements using methods named after the tags./
|
15
|
+
See <a href="https://github.com/fboccacini/extreml">https://github.com/fboccacini/extreml</a> for reference and usage.
|
111
16
|
email: fboccacini@gmail.com
|
112
17
|
executables: []
|
113
18
|
extensions: []
|