web_stat 0.5.0 → 0.5.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
  SHA256:
3
- metadata.gz: d3f6f4f9692846a2c50a365125efb42dfd4a0b44fddef1c108621d94fd6dcde4
4
- data.tar.gz: 2f6d400bce014144c940edcafbad9dc4e8c164fce356c70bfd7dbd1ad0c2f862
3
+ metadata.gz: 6272119868a8870fda3ab8c33fee1238c5a8ca6c0859ce96f77e127c097cd2a8
4
+ data.tar.gz: a54ba5ce70af23594694cf6d8585391b6632b75ff4f6ee9f3067c987146b4752
5
5
  SHA512:
6
- metadata.gz: 6518aaed72267de7612257c43067a762b933d2e1a64d04defb07d7471eacd8bd1a4ca1cadc96dad5b279cc09a4bbc5a3453abfe10715bde5dc614d08d1953098
7
- data.tar.gz: 3cd03188f34030da0c9ead6633bd1c67550524c22368b5c52dd69132e54be69edff6a28d7a91b6ff76ad02a6f3bb2becebb2df1e03db72fd7f3f16262d8137e2
6
+ metadata.gz: 61fbcb05d550f7363c14da7cb951fcf282dc500485cc8be82467a3c991dfce86822c7670a0d0a06ba45caf1718a37492b0830394dea444d9d6d339787c912956
7
+ data.tar.gz: aaef967c6dbfe7883154fcca87e2f0a1f8f12fc12ee42a6c232d65283850f3948d7cc58a0f974bc60572da6fa164b85c8aee571690450fd59ae88481372ecd7b
data/lib/web_stat.rb CHANGED
@@ -2,6 +2,7 @@ require "bundler"
2
2
 
3
3
  require 'cld'
4
4
  require 'uri'
5
+ require 'erb'
5
6
  require 'digest'
6
7
  require 'logger'
7
8
  require 'sanitize'
@@ -20,6 +20,7 @@ development: &development
20
20
  youtube: 'http://img.youtube.com/vi/\1/default.jpg'
21
21
  api_keys:
22
22
  youtube: "dummy-key"
23
+ lang: <%= ENV['LANG'] %>
23
24
  test:
24
25
  <<: *development
25
26
  production:
@@ -7,9 +7,9 @@ module WebStat
7
7
  # Get yaml
8
8
  def get
9
9
  if defined? Rails
10
- YAML.load_file(get_configure_path)[Rails.env]
10
+ YAML.load(ERB.new(File.read(get_configure_path)).result)[Rails.env]
11
11
  else
12
- YAML.load_file(get_configure_path)[ENV["ENV"] || "production"]
12
+ YAML.load(ERB.new(File.read(get_configure_path)).result)[ENV["ENV"] || "production"]
13
13
  end
14
14
  end
15
15
 
@@ -34,7 +34,7 @@ module WebStat
34
34
  end
35
35
  # Get main section
36
36
  def content
37
- if @url.match(WebStat::Configure.get["id_extraction_regexs"]["youtube"])
37
+ if @url&.match(WebStat::Configure.get["id_extraction_regexs"]["youtube"])
38
38
  youtube_decscription
39
39
  else
40
40
  Sanitize.clean(Readability::Document.new(@nokogiri.at('body').to_s).content)
@@ -1,3 +1,3 @@
1
1
  module WebStat
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -26,4 +26,8 @@ RSpec.describe WebStat::Configure do
26
26
  end
27
27
  end
28
28
  end
29
+
30
+ it "Environment variables can be read on YAML" do
31
+ expect(WebStat::Configure.get["lang"]).to eq "C.UTF-8"
32
+ end
29
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_stat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yusuke abe