front-matter 1.2.0 → 1.2.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -3
  3. data/lib/front_matter.rb +6 -3
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 337d37bb9c3faadf64d8c03c86286de9097e4b4e
4
- data.tar.gz: 0473934f4b36d31f878889861cbe1ec63a51a7b5
3
+ metadata.gz: 6208f7995bb901ffe4a941e3b097844779d7d1da
4
+ data.tar.gz: 45c54c2850af9382dd138d8ada7a4fb1ffaee6ed
5
5
  SHA512:
6
- metadata.gz: 6b92c9fe14b26de9492a37e5999510b6d205efea8b26f1350e9ae429ac45ae991b26cc3cdc59491526ff46dadccfbc0d772247e62232098a808050ccae5e2b5b
7
- data.tar.gz: d8ab7084aa147a7ed9db710a64f7c92db7f60fc1af4b7641ec38573cfad009921a0c6d8b0a118f4558fd0cbbdd61ab26ef06a2b46bc62cd877500fa01c845bff
6
+ metadata.gz: aeb5a98fe8c53237e89bc8c290435b783e340645002c8fc0e3637cb42f4d8ab74bca4965d73769ae187298398693570c4a27fcafdc1adca7c3aa2bc6860e0310
7
+ data.tar.gz: 9229878cf7449ed1cdf2674c2cda34ea77633546f8d31ef13e84c48f88a197b21cdc8802dbde9c996c13559a44d6c71c25c5558aca0a5a428fed1a1a0dba5340
data/README.md CHANGED
@@ -53,14 +53,13 @@ require "yaml"
53
53
  fm = FrontMatter.new(:unindent => true, :as_yaml => true)
54
54
  file = "README.md"
55
55
 
56
-
57
- ap YAML.load(fm.extract_file(file)[0])
56
+ front_matters = fm.extract_file(file)
57
+ ap YAML.load(front_matters[0])
58
58
 
59
59
  # {
60
60
  # "Gem" => "front_matter",
61
61
  # "Author" => "Zhao Cai",
62
62
  # "Email" => "caizhaoff@gmail.com",
63
- # "Homepage" => "https://github.com/zhaocai/",
64
63
  # "Tag" => [
65
64
  # "ruby",
66
65
  # "yaml",
@@ -15,7 +15,7 @@ require 'facets/string'
15
15
  require 'front_matter/core/array'
16
16
 
17
17
  class FrontMatter
18
- VERSION = '1.2.0'
18
+ VERSION = '1.2.1'
19
19
  attr_accessor :setting
20
20
  def initialize( opts={} )
21
21
  comment_marker = %r{(?<comment> ^\s* \W{1,2} )}x
@@ -71,7 +71,7 @@ class FrontMatter
71
71
  if opts[:firstline] || opts[:lastline]
72
72
  firstline = opts[:firstline] ? opts[:firstline] - 1 : 0
73
73
  lastline = opts[:lastline] ? opts[:lastline] -1 : -1
74
- return extract(File.readlines(path)[firstline..lastline].join("\n"), filetype)
74
+ return extract(File.readlines(path)[firstline..lastline].join, filetype)
75
75
  else
76
76
  return extract(File.read(path), filetype)
77
77
  end
@@ -81,4 +81,7 @@ class FrontMatter
81
81
  end
82
82
 
83
83
 
84
-
84
+ if __FILE__ == $0
85
+ fm = FrontMatter.new(:unindent => true, :as_yaml => true)
86
+ puts fm.extract_file(__FILE__, :firstline => 1, :lastline => 15)
87
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: front-matter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zhao Cai