icon_for 0.3.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa3cc517989a4ea34757ee72df5f6b62b336737a
4
- data.tar.gz: 743a9a561979f9518854d8fd7da2f3c84e275203
3
+ metadata.gz: a4d5e2fa8bfcfcc0af8bc46d9397b38c0e234cd3
4
+ data.tar.gz: 27f70f2b6098b66b1cab44e081cc61e7397d9f28
5
5
  SHA512:
6
- metadata.gz: badd627bf4c688a31a2b45da2e6606a0a8c7d62fc3790ed09ecadbe82e8d5ff9ae7150aa37417ef52d8005339dc4b3ba1dd30d2d906f3e5ddc0c3c223c776b78
7
- data.tar.gz: 5b891302d6b760e833a2ea544562d4c7646b49eb9a68c5b369ef17b974d0d4c65cd1eb40b5bd2b306bab9397139e47d2758852c297664ba89c9b1a1dff5d9e4f
6
+ metadata.gz: 429138d307659cb3e8a29c8a916635f42e7658df3c99ec0251c0c18bc22011f59ead7ab784163f53ac1047249cbbf07dd10dae9507b7ef980239d0081e3cc563
7
+ data.tar.gz: 2efa741fe9acde42d4c79c3798ee0dbc0cd7dd7699243dcafdd454a8e47d93125de6b7bd778e05a493a89771338dce847bb943493509a5da5f9d0eaabc852b92
@@ -3,14 +3,14 @@ require "json"
3
3
  module IconFor
4
4
  class IconSet
5
5
  def initialize data
6
- if data.is_a? File
7
- @data = JSON.load data
8
- else
9
- @data = data
6
+ case data
7
+ when Hash then @data = data
8
+ when String then @data = JSON.parse data
9
+ when File then @data = JSON.parse data.read
10
10
  end
11
11
  end
12
12
 
13
- def [] mime
13
+ def [] mime, prefix: IconFor.config.prefix, suffix: IconFor.config.suffix
14
14
  if @data["types"].key? mime
15
15
  icon = @data["types"][mime]
16
16
  else
@@ -21,7 +21,7 @@ module IconFor
21
21
  icon = "fallback"
22
22
  end
23
23
  end
24
- "#{IconFor.config.prefix}#{@data["icons"][icon]}#{IconFor.config.suffix}"
24
+ "#{prefix}#{@data["icons"][icon]}#{suffix}"
25
25
  end
26
26
  end
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module IconFor
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icon_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - phi2dao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-23 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler