swifty 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/swifty.rb +29 -22
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57a90997cc50119744038c19c113825e584ab9c1
4
- data.tar.gz: 821bcd7a5de7e330c188eba9c38907a5c9ddabe3
3
+ metadata.gz: 67c77340ca685c1925abcb020769941fa807a53c
4
+ data.tar.gz: 22c0922842601a9e670606d1ffab6451da465d13
5
5
  SHA512:
6
- metadata.gz: 857a4322c5b5a1b6f167fe6ef96a096a7951887b51280bee228503d32d9ba2ed595b38a7d8224c92660db34a95d73440c15cd93e5c31a82e8599a6feed00f540
7
- data.tar.gz: 92d9a8da48ba2882b26bd007a7bc42f8fc2e7bb3f8ab55a4bc1c6efef11e6923c3448aab56abd8d28a91955a7c808cf748d81a37de2329c60984e1e8eeea36af
6
+ metadata.gz: e60566127d16029bc310477569f290054af669add0b0ac910abe8f69b3ddf34f3f55fe0d36cf253b9bbb60b6622ea24adadd50d14784bff85456af199e50e664
7
+ data.tar.gz: a897b89cdfc46c104187783dad8de959d17e73cf3b196e367be86a7bf2f250cb190022ecc5720c1025e46cbe119e8a2d3a4534653cc404f1f3ef284958fcf170
@@ -39,32 +39,39 @@ module Cmxl
39
39
  end
40
40
  end
41
41
 
42
- class Swifty
43
- attr_reader :content, :options, :statement
42
+ module Swifty
43
+ class Parser
44
+ attr_reader :content, :options, :statement
44
45
 
45
- def initialize(content, **options)
46
- @options = options
47
- @content = content.is_a?(File) ? content.read : content
48
- @statement ||= Cmxl.parse(content, encoding: options[:encoding]).first
49
- end
46
+ def initialize(content, **options)
47
+ @options = options
48
+ @content = content.is_a?(File) ? content.read : content
49
+ @statement ||= Cmxl.parse(content, encoding: options[:encoding]).first
50
+ end
50
51
 
51
- def to_hash
52
- statement.to_hash
53
- end
52
+ def to_hash
53
+ statement.to_hash
54
+ end
54
55
 
55
- def to_yaml
56
- to_hash.to_yaml
57
- end
58
- alias_method :to_yml, :to_yaml
56
+ def to_yaml
57
+ to_hash.to_yaml
58
+ end
59
+ alias_method :to_yml, :to_yaml
59
60
 
60
- def save(file)
61
- File.open(file, 'w+') { |f| f.write to_yaml }
62
- to_hash
63
- end
61
+ def save(file)
62
+ File.open(file, 'w+') { |f| f.write to_yaml }
63
+ to_hash
64
+ end
64
65
 
65
- private
66
+ private
66
67
 
67
- def method_missing(name, *args)
68
- return statement.send(name, *args)
69
- end
68
+ def method_missing(name, *args)
69
+ return statement.send(name, *args)
70
+ end
71
+ end
72
+
73
+ def new(*args)
74
+ Parser.new(*args)
75
+ end
76
+ module_function :new
70
77
  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.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Kampp