meteor 0.9.13 → 0.9.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/demo/xhtml.rb CHANGED
@@ -3,20 +3,22 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  # require 'rubygems'
6
- require 'meteor'
6
+ require "meteor"
7
7
 
8
- Meteor::ElementFactory.link(:xhtml,'ml/sample_xhtml.html', 'UTF-8')
9
- root = Meteor::ElementFactory.element('/ml/sample_xhtml')
8
+ Meteor::ElementFactory.link(:xhtml, "ml/sample_xhtml.html", "UTF-8")
9
+ root = Meteor::ElementFactory.element("/ml/sample_xhtml")
10
10
 
11
11
  startTime = Time.new.to_f
12
12
 
13
- elm_hello = root.element(id: 'hello')
14
- elm_hello['class'] = 'red' # elm_hello.attr(class: "red")
13
+ elm_hello = root.element(id: "hello")
14
+ # elm_hello.attr(class: "red")
15
+ elm_hello["class"] = "red"
15
16
  # elm_hello['class'] = nil # elm_hello.remove_attr('class')
16
17
  # elm_hello.attr(class: nil)
17
18
 
18
- elm_hello2 = root.element(id: 'hello2')
19
- elm_hello2.content = "Hello,Tester" # elm_hello2.content("Hello,Tester")
19
+ elm_hello2 = root.element(id: "hello2")
20
+ # elm_hello2.content("Hello,Tester")
21
+ elm_hello2.content = "Hello,Tester"
20
22
  # elm_hello2.remove
21
23
 
22
24
  # elm_hello3 = root.cxtag("hello3")
@@ -24,10 +26,13 @@ elm_hello2.content = "Hello,Tester" # elm_hello2.content("Hello,Tester")
24
26
  # puts elm_hello3.content
25
27
  # puts elm_hello3.mixed_content
26
28
 
27
- elm_text1 = root.element(id: 'text1')
28
- elm_text1['value'] = 'めも' # elm_text1.attr(value: 'めも')
29
- elm_text1['disabled'] = true # elm_text1.attr(disabled: true)
30
- elm_text1['required'] = true # elm_text1.attr(required: true)
29
+ elm_text1 = root.element(id: "text1")
30
+ # elm_text1.attr(value: 'めも')
31
+ elm_text1["value"] = "めも"
32
+ # elm_text1.attr(disabled: true)
33
+ elm_text1["disabled"] = true
34
+ # elm_text1.attr(required: true)
35
+ elm_text1["required"] = true
31
36
  # map = elm_text1.attr_map
32
37
  # map.names.each { |item|
33
38
  # puts item
@@ -46,33 +51,39 @@ elm_text1['required'] = true # elm_text1.attr(required: true)
46
51
  # puts elm_option1['selected'] # puts elm_option1.attr("selected")
47
52
  # puts elm_text1['readonly'] # puts elm_text1.attr("readonly")
48
53
 
49
- elm_select2 = root.element("select",id: "select2")
54
+ elm_select2 = root.element("select", id: "select2")
50
55
  elm_select2["multiple"] = true
51
- elm_option2 = elm_select2.element("option",id: "option2")
52
- co_elm = elm_option2.element()
56
+ elm_option2 = elm_select2.element("option", id: "option2")
57
+ co_elm = elm_option2.element
53
58
  10.times { |i|
54
- if i == 1 then
55
- co_elm['selected'] = true # co_elm.attr(selected: true)
59
+ if i == 1
60
+ # co_elm.attr(selected: true)
61
+ co_elm["selected"] = true
56
62
  else
57
- co_elm['selected'] = false # co_elm.attr(selected: false)
63
+ # co_elm.attr(selected: false)
64
+ co_elm["selected"] = false
58
65
  end
59
- co_elm['value'] = i # co_elm.attr(value: i)
60
- co_elm['id'] = nil # co_elm.remove_attr("id")
61
- co_elm.content = i # co_elm.content(i)
66
+ # co_elm.attr(value: i)
67
+ co_elm["value"] = i
68
+ # co_elm.remove_attr("id")
69
+ co_elm["id"] = nil
70
+ # co_elm.content(i)
71
+ co_elm.content = i
62
72
  co_elm.flash
63
73
  }
64
74
 
65
- elm_tr1 = root.element('tr',id: 'loop')
75
+ elm_tr1 = root.element("tr", id: "loop")
66
76
  elm_ = elm_tr1.element
67
- elm_dt1_ = elm_.element(id: 'aa')
68
- elm_dt2_ = elm_.element(id: 'bb')
69
- elm_dt3_ = elm_.element(id: 'cc')
77
+ elm_dt1_ = elm_.element(id: "aa")
78
+ elm_dt2_ = elm_.element(id: "bb")
79
+ elm_dt3_ = elm_.element(id: "cc")
70
80
  10.times { |i|
71
- elm_['loop'] = i
81
+ elm_["loop"] = i
72
82
  elm_dt1 = elm_dt1_.clone
73
83
  elm_dt2 = elm_dt2_.clone
74
84
  elm_dt3 = elm_dt3_.clone
75
- elm_dt1.content = i # elm_dt1.content("<>\"' \n" << i.to_s)
85
+ # elm_dt1.content("<>\"' \n" << i.to_s)
86
+ elm_dt1.content = i
76
87
  elm_dt2.content = i
77
88
  elm_dt3.content = i
78
89
  elm_.flash
@@ -82,9 +93,9 @@ root.flash
82
93
 
83
94
  endTime = Time.new.to_f
84
95
 
85
- puts root.document
96
+ puts(root.document)
86
97
 
87
- puts "charset:#{root.charset}"
88
- puts "content-type:#{root.content_type}"
98
+ puts("charset:#{root.charset}")
99
+ puts("content-type:#{root.content_type}")
89
100
 
90
- puts '' + (endTime - startTime).to_s + ' sec'
101
+ puts("" + (endTime - startTime).to_s + " sec")
data/demo/xhtml4.rb CHANGED
@@ -3,19 +3,21 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  # require 'rubygems'
6
- require 'meteor'
6
+ require "meteor"
7
7
 
8
- Meteor::ElementFactory.link(:xhtml4,'ml/sample_xhtml4.html', 'UTF-8')
9
- root = Meteor::ElementFactory.element('/ml/sample_xhtml4')
8
+ Meteor::ElementFactory.link(:xhtml4, "ml/sample_xhtml4.html", "UTF-8")
9
+ root = Meteor::ElementFactory.element("/ml/sample_xhtml4")
10
10
 
11
11
  startTime = Time.new.to_f
12
12
 
13
- elm_hello = root.element("id","hello")
14
- elm_hello['class'] = 'red' # elm_hello.attr(class: "red")
13
+ elm_hello = root.element("id", "hello")
14
+ # elm_hello.attr(class: "red")
15
+ elm_hello["class"] = "red"
15
16
  # elm_hello['class'] = nil # elm_hello.remove_attr('class')
16
17
 
17
18
  elm_hello2 = root.element(id: "hello2")
18
- elm_hello2.content = "Hello,Tester" # elm_hello2.content("Hello,Tester")
19
+ # elm_hello2.content("Hello,Tester")
20
+ elm_hello2.content = "Hello,Tester"
19
21
  # elm_hello2.remove
20
22
 
21
23
  # elm_hello3 = root.cxtag("hello3")
@@ -33,7 +35,8 @@ elm_hello2.content = "Hello,Tester" # elm_hello2.content("Hello,Tester")
33
35
  # }
34
36
 
35
37
  elm_radio1 = root.element("input", id: "radio1", type: "radio")
36
- elm_radio1['checked'] = true # elm_radio1.attribute(checked: true)
38
+ # elm_radio1.attribute(checked: true)
39
+ elm_radio1["checked"] = true
37
40
 
38
41
  # elm_select1 = root.element("select",id: "select1")
39
42
  # elm_select1 = root.element("select")
@@ -45,33 +48,39 @@ elm_radio1['checked'] = true # elm_radio1.attribute(checked: true)
45
48
  # puts elm_option1['selected'] # puts elm_option1.attr("selected")
46
49
  # puts elm_option1['readonly'] # puts elm_text1.attr("readonly")
47
50
 
48
- elm_select2 = root.element("select",id: "select2")
51
+ elm_select2 = root.element("select", id: "select2")
49
52
  elm_select2["multiple"] = true
50
- elm_option2 = elm_select2.element("option",id: "option2")
51
- co_elm = elm_option2.element()
53
+ elm_option2 = elm_select2.element("option", id: "option2")
54
+ co_elm = elm_option2.element
52
55
  10.times { |i|
53
- if i == 1 then
54
- co_elm['selected'] = true # co_elm.attr(selected: true)
56
+ if i == 1
57
+ # co_elm.attr(selected: true)
58
+ co_elm["selected"] = true
55
59
  else
56
- co_elm['selected'] = false # co_elm.attr(selected: false)
60
+ # co_elm.attr(selected: false)
61
+ co_elm["selected"] = false
57
62
  end
58
- co_elm['value'] = i # co_elm.attr(value: i)
59
- co_elm['id'] = nil # co_elm.remove_attr("id")
60
- co_elm.content = i # co_elm.content(i)
63
+ # co_elm.attr(value: i)
64
+ co_elm["value"] = i
65
+ # co_elm.remove_attr("id")
66
+ co_elm["id"] = nil
67
+ # co_elm.content(i)
68
+ co_elm.content = i
61
69
  co_elm.flash
62
70
  }
63
71
 
64
- elm_tr1 = root.element('tr',id: 'loop')
72
+ elm_tr1 = root.element("tr", id: "loop")
65
73
  elm_ = elm_tr1.element
66
- elm_dt1_ = elm_.element(id: 'aa')
67
- elm_dt2_ = elm_.element(id: 'bb')
68
- elm_dt3_ = elm_.element(id: 'cc')
74
+ elm_dt1_ = elm_.element(id: "aa")
75
+ elm_dt2_ = elm_.element(id: "bb")
76
+ elm_dt3_ = elm_.element(id: "cc")
69
77
  10.times { |i|
70
- elm_['loop'] = i
78
+ elm_["loop"] = i
71
79
  elm_dt1 = elm_dt1_.clone
72
80
  elm_dt2 = elm_dt2_.clone
73
81
  elm_dt3 = elm_dt3_.clone
74
- elm_dt1.content = i # elm_dt1.content("<>\"' \n" << i.to_s)
82
+ # elm_dt1.content("<>\"' \n" << i.to_s)
83
+ elm_dt1.content = i
75
84
  elm_dt2.content = i
76
85
  elm_dt3.content = i
77
86
  elm_.flash
@@ -81,9 +90,9 @@ root.flash
81
90
 
82
91
  endTime = Time.new.to_f
83
92
 
84
- puts root.document
93
+ puts(root.document)
85
94
 
86
- puts "charset:#{root.charset}"
87
- puts "content-type:#{root.content_type}"
95
+ puts("charset:#{root.charset}")
96
+ puts("content-type:#{root.content_type}")
88
97
 
89
- puts '' + (endTime - startTime).to_s + ' sec'
98
+ puts("" + (endTime - startTime).to_s + " sec")
data/demo/xml.rb CHANGED
@@ -3,10 +3,10 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  # require 'rubygems'
6
- require 'meteor'
6
+ require "meteor"
7
7
 
8
- Meteor::ElementFactory.link(Meteor::XML,'ml/sample.xml', 'UTF-8')
9
- root = Meteor::ElementFactory.element('/ml/sample')
8
+ Meteor::ElementFactory.link(Meteor::XML, "ml/sample.xml", "UTF-8")
9
+ root = Meteor::ElementFactory.element("/ml/sample")
10
10
 
11
11
  start_time = Time.new.to_f
12
12
 
@@ -21,7 +21,8 @@ start_time = Time.new.to_f
21
21
  # puts elm_.attributes
22
22
  # puts elm_.mixed_content
23
23
 
24
- elm1 = root.element('test', manbo: 'manbo') # elm1 = root.element(manbo: "manbo")
24
+ # elm1 = root.element(manbo: "manbo")
25
+ elm1 = root.element("test", manbo: "manbo")
25
26
  # elm2 = root.element(id: "aa", id2: "bb") # elm2 = root.element(id: "aa")
26
27
  # elm3 = root.element("potato", id: "aa")
27
28
  # elm4 = root.element("potato", id: "aa", id2: "bb") # elm4 = root.element("potato", id2: "bb")
@@ -58,11 +59,11 @@ elm7 = root.element("kobe")
58
59
  # }
59
60
 
60
61
  elm_ = root.element(elm1)
61
- elm5_ = elm_.element('tech')
62
+ elm5_ = elm_.element("tech")
62
63
  10.times do |i|
63
- elm_['manbo'] = i.to_s
64
+ elm_["manbo"] = i.to_s
64
65
  elm5 = elm5_.clone
65
- elm5['mono'] = i.to_s
66
+ elm5["mono"] = i.to_s
66
67
  elm5.content = i.to_s
67
68
  elm_.flash
68
69
  end
@@ -76,9 +77,10 @@ end
76
77
  elm_ = root.element(elm7)
77
78
 
78
79
  10.times { |i|
79
- elm_["momo"]= i
80
+ elm_["momo"] = i
80
81
  elm_["eco"] = "えま"
81
- elm_.content = i # elm_["content"] = i.to_s
82
+ # elm_["content"] = i.to_s
83
+ elm_.content = i
82
84
  elm_.flash
83
85
  }
84
86
 
@@ -95,24 +97,27 @@ root.flash
95
97
 
96
98
  end_time = Time.new.to_f
97
99
 
98
- puts root.document
100
+ puts(root.document)
99
101
 
100
102
  # elms = root.elements("potato2")
101
103
  ## elms = root.elements("kobe")
102
104
  # elms = root.elements("potato")
103
105
 
104
- elms = root.elements("test") # elms = root.css('test')
105
- elms.each{|elm, i|
106
- puts '-------'
107
- puts 'doc----'
108
- puts elm.document
109
- puts 'attrs--'
110
- puts elm.attributes
111
- puts 'mixed--'
112
- puts elm.mixed_content
106
+ # elms = root.css('test')
107
+ elms = root.elements("test")
108
+ elms.each { |elm, i|
109
+ puts("-------")
110
+ puts("doc----")
111
+ puts(elm.document)
112
+ puts("attrs--")
113
+ puts(elm.attributes)
114
+ puts("mixed--")
115
+ puts(elm.mixed_content)
113
116
  }
114
117
 
115
- puts '' + (end_time - start_time).to_s + ' sec'
118
+ puts("content-type:#{root.content_type}")
119
+
120
+ puts("" + (end_time - start_time).to_s + " sec")
116
121
 
117
122
  # start_time = Time.new.to_f
118
123
  # obj = eval("\"#{elm3.name}\"")
@@ -14,12 +14,12 @@ module Meteor
14
14
  #
15
15
  def initialize(*args)
16
16
  case args.length
17
- when ZERO
18
- initialize_0
19
- when ONE
20
- initialize_1(args[0])
21
- else
22
- raise ArgumentError
17
+ when ZERO
18
+ initialize_0
19
+ when ONE
20
+ initialize_1(args[0])
21
+ else
22
+ raise ArgumentError
23
23
  end
24
24
  end
25
25
 
@@ -59,6 +59,7 @@ module Meteor
59
59
  attr.changed = true
60
60
  attr.removed = false
61
61
  end
62
+
62
63
  @map[name] = attr
63
64
  else
64
65
  attr = @map[name]
@@ -66,6 +67,7 @@ module Meteor
66
67
  attr.changed = true
67
68
  attr.removed = false
68
69
  end
70
+
69
71
  attr.value = value
70
72
  end
71
73
  end