swifty 0.0.1 → 0.0.2.alpha

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/swifty.rb +10 -7
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7decbf923c67ea0f5f371facb0404c76aa2aaa36
4
- data.tar.gz: 0774bc7e4cffec29074eca735c793cb193ab1bb3
3
+ metadata.gz: babd98ede59a2b1ba2eaa523b90deea2039f8d02
4
+ data.tar.gz: d7d95e9889664bc5be426385d1b18974533a1bc8
5
5
  SHA512:
6
- metadata.gz: 74231388edd75f900675a37cbb64176db27158e8b51be6f2c3d2e84ad5cdf8628141f8d7f787a3235c45458ab781d1762fd40e32e15a9288bfc0814ba2c215df
7
- data.tar.gz: 884301c0dd5d5a975245f0728c2702a616d45da3b55f68a64e30eb13c55541bdb6b16ed32fc5fd0aaebc9463ca01b776c847f7dc8b68d6de90f2cf50f38d90d6
6
+ metadata.gz: 73cfc83423a1e1dca3e6e5f207ab08c75871e48edf1da57002b1ebfa6261d183ddcf9cea08ca449498937bf113de5d2a9951846b470e0eb25c83dbf8dd99c0d6
7
+ data.tar.gz: 5700c57a11e8f2cb6ebd3dff5ff270ec0055629b08fc053df0c299c312da6607f96d70dfc1baa2400ee2e54e2f1a75bf25bbd470ff831730275f04a7229d91ec
data/lib/swifty.rb CHANGED
@@ -12,16 +12,19 @@ require 'yaml'
12
12
  require 'exceptions'
13
13
 
14
14
  class Swifty
15
- attr_reader :content, :options
15
+ attr_reader :content, :options, :statement
16
16
 
17
- def initialize(file, **options)
17
+ def initialize(content, **options)
18
18
  @options = options
19
- @content = file.is_a?(File) ? file.read : File.read(file)
19
+ @content = content.is_a?(File) ? content.read : content
20
+ @statement ||= Cmxl.parse(content, encoding: options[:encoding]).first
20
21
  end
21
22
 
22
- private
23
+ def to_hash
24
+ statement.to_hash
25
+ end
23
26
 
24
- def statements
25
- @statements ||= Cmxl.parse content, encoding: options[:encoding]
26
- end
27
+ def to_yaml
28
+ to_hash.to_yml
29
+ end
27
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swifty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Kampp
@@ -32,9 +32,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
32
32
  version: '0'
33
33
  required_rubygems_version: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - ">="
35
+ - - ">"
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 1.3.1
38
38
  requirements: []
39
39
  rubyforge_project:
40
40
  rubygems_version: 2.4.8