metaheader 1.2 → 1.2.1

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: b27a892f14adfb3c27237943a6092a25e7976b4a
4
- data.tar.gz: 066516c6ee0af9a85544ef3ab226c249d2ed6d78
3
+ metadata.gz: 072b809611c9fdd9b3cda179f3a755ddef92685f
4
+ data.tar.gz: 0e68adce0f7675b27aa6ce58ce26f43de34f392e
5
5
  SHA512:
6
- metadata.gz: 0062129b4f626c499d89d340f6a43eb5f4a65ecf15632c186c9e3dbae68f5799c719e19d30b7c6835f5c98ccc7baf936fb5c0734a53e776d0d871ffa23bf29c7
7
- data.tar.gz: 99f9068fbc6118c4bab541d6c96b8344ad80838f73990d9197ca0d2231a18af454975134ddf46afe1613c38842cd8bbd383d6e190f97c323507a51f0ee7e49d8
6
+ metadata.gz: 64c0785eb124d9a096467f11b3449a6def1c5a7b65c8198b378c04cdcfd45c0c27297df386746c4f0e3d28e142a9d3fcce05e07287a7d5f0ad39cce3d9027a6a
7
+ data.tar.gz: 15b1bd95e2fc1d4c8578e0d1eae8fa2a4a61e153ce307cbbc8fbe4526bfd2813995dc276ba557a5317350878d26f80e263f903e2db34101953530fad46e0f1ad
data/lib/metaheader.rb CHANGED
@@ -46,6 +46,17 @@ class MetaHeader
46
46
  self.new File.read(path)
47
47
  end
48
48
 
49
+ # Construct a new MetaHeader object or return the object untouched
50
+ # @param input [String, MetaHeader]
51
+ # @return [MetaHeader]
52
+ def self.parse(input)
53
+ if input.is_a? self
54
+ input
55
+ else
56
+ self.new input
57
+ end
58
+ end
59
+
49
60
  # Parse every tags found in input up to the first newline.
50
61
  # @param input [String]
51
62
  def initialize(input)
@@ -1,4 +1,4 @@
1
1
  class MetaHeader
2
2
  # MetaHeader's version
3
- VERSION = '1.2'.freeze
3
+ VERSION = '1.2.1'.freeze
4
4
  end
data/test/test_parser.rb CHANGED
@@ -267,4 +267,9 @@ class TestParser < MiniTest::Test
267
267
  mh.delete :hello
268
268
  refute mh.has?(:hello)
269
269
  end
270
+
271
+ def test_construct_from_instance
272
+ mh = MetaHeader.new '@hello world'
273
+ assert_same mh, MetaHeader.parse(mh)
274
+ end
270
275
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metaheader
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - cfillion
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-20 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler