xrt 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60911a855be15e5cc634ea8efaf464ff478ba591
4
- data.tar.gz: e57a1f273278eb63443708444b3f239902d124d6
3
+ metadata.gz: 522fc466d294244892a5bbc592f6eada3fe5b1fb
4
+ data.tar.gz: bb90d04bbd0e92f87b6ce9285cd2955eed534874
5
5
  SHA512:
6
- metadata.gz: 47470f9a585967c8410c0062a49f8caf7981bf89f5ceb12d3580e7953957a9f86656805f49b28bdc23d8501998e2d37219c3d5b3b444b25e98f1cff325396d8e
7
- data.tar.gz: 99fd86545e72f3d627566cc211d4a83fe6ce58341ecc4c74c92983395d26b30996ace9dfd3ad77e28b9a8eb1d8854f85e80f164d889dab7eba76c1951d14d1ef
6
+ metadata.gz: 3d3d56352e6f7eae2dc34841c4904d9d9562fef2772cf6cdfef92c41d2780377cd0044d754da1595852fb94113cedb358ed8bb0a046807a62fa1052ff1c871b4
7
+ data.tar.gz: 6ff6151ddfdc56e96edbd492d860e584c4a03c8baa4acb7d630e1500f3199aa03e80aff932cb0217964be67fa276cc0714880828857afe9c230b58af97ee7493
@@ -204,7 +204,10 @@ module XRT
204
204
  end
205
205
 
206
206
  def tag_name
207
- @children[1].content.match(%r{\A/?(\S+)})[1].downcase
207
+ return nil if @children.empty?
208
+ matched = @children[1].content.match(%r{\A/?(\w+)})
209
+ return nil unless matched
210
+ return matched[1].downcase
208
211
  end
209
212
 
210
213
  def tag_opening?
@@ -1,3 +1,3 @@
1
1
  module Xrt
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -268,6 +268,19 @@ class TestTag < Test::Unit::TestCase
268
268
  }
269
269
  end
270
270
 
271
+ def test_tag_name_when_parse_failed
272
+ tag = XRT::Statement::Tag.new('<')
273
+ tag << XRT::Statement::Text.new(' 1')
274
+ tag << XRT::Statement::TagEnd.new('>')
275
+ assert_equal nil, tag.tag_name
276
+ end
277
+
278
+ def test_tag_name_when_empty_broken_tag
279
+ tag = XRT::Statement::Tag.new('<')
280
+ tag << XRT::Statement::TagEnd.new('>')
281
+ assert_equal nil, tag.tag_name
282
+ end
283
+
271
284
  def test_void_element?
272
285
  [
273
286
  ['div', false],
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xrt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - hitode909