Skip to content

Commit

Permalink
Merge pull request #276 from bkeepers/leading-space
Browse files Browse the repository at this point in the history
Allow leading whitespace
  • Loading branch information
bkeepers authored Jan 15, 2017
2 parents 5c9d538 + 488e345 commit 8f427d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/dotenv/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Parser

LINE = /
\A
\s*
(?:export\s+)? # optional export
([\w\.]+) # key
(?:\s*=\s*|:\s+?) # separator
Expand Down
4 changes: 4 additions & 0 deletions spec/dotenv/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ def env(string)
expect(env("FOO= bar")).to eql("FOO" => "bar")
end

it "parses values with leading spaces" do
expect(env(" FOO=bar")).to eql("FOO" => "bar")
end

it "parses double quoted values" do
expect(env('FOO="bar"')).to eql("FOO" => "bar")
end
Expand Down

0 comments on commit 8f427d7

Please sign in to comment.