import_as 0.1.0 → 0.2.0

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: 59817ca2a75b87a2d6adfa4d5899465b37436e009c33707a63822436d4a7faec
4
- data.tar.gz: cb08fe7083bffe484ca3537bdee10ab4ea251fcb3d343f66ab8e2ce7efa10fa0
3
+ metadata.gz: 3a61c13065e4cee771ece7fdfde24bfd5e674984fb3858d233ca27f780c2abcd
4
+ data.tar.gz: 9394f7ae70d7cf67ef59655c1b9584bfdb9fc72f389f8e5caa6051f2fe87d7f8
5
5
  SHA512:
6
- metadata.gz: 1a8ffd7b76832592b47bce9c6a1424ca8b60d6bee71ab448c24c0991e8e50da04d6752942d3c9c74e56e387eed65c426427fb8d2ede23e22176e07be1b9dfeb5
7
- data.tar.gz: f24389ad132cd9786025ebe56c9dc636b88a121b3e5619831a25522fadc59be9a922961ee811122d50b1d9ba7c8d716a9d6dc201a6803f05698d3dbade4ea04e
6
+ metadata.gz: d2deb4452e878c436b28fef0ad6a050d7878ea4551785f611fc7279b409964c083196cbb99029eaa03b05f7d93be411c83c28d83f84f8b47e57d24c2069cc803
7
+ data.tar.gz: 57ed548f3aac70fce9f06596fa5d06648f53ba49213a3d6eadadf3f2de1a0796a0a0ba9a26eb638a8376c9e24554aad748492ea6ae3b5b75de3299784d89f5aa
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- import_as (0.1.0)
4
+ import_as (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
+ spec.required_ruby_version =">= 2.6.0"
24
25
  spec.add_development_dependency "bundler", "~> 2.0.a"
25
26
  spec.add_development_dependency "rake", "~> 10.0"
26
27
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -1,6 +1,5 @@
1
1
  require "import_as/version"
2
2
  require "ripper"
3
- require "tempfile"
4
3
 
5
4
  module ImportAs
6
5
  class Error < StandardError; end
@@ -31,15 +30,8 @@ module ImportAs
31
30
  end
32
31
 
33
32
  def from(path)
34
- Tempfile.open(["import_as", ".rb"]) do |tf|
35
- new_source = rewrite(File.read(path))
36
-
37
- tf.write(new_source)
38
- tf.flush
39
- tf.close
40
-
41
- load tf.path
42
- end
33
+ new_source = rewrite(File.read(path))
34
+ eval(new_source, TOPLEVEL_BINDING, path)
43
35
  end
44
36
 
45
37
  private
@@ -54,19 +46,19 @@ module ImportAs
54
46
 
55
47
  refine(RubyVM::AbstractSyntaxTree::Node) do
56
48
  def array?
57
- type == "NODE_ARRAY"
49
+ type == :ARRAY
58
50
  end
59
51
 
60
52
  def const?
61
- type == "NODE_CONST"
53
+ type == :CONST
62
54
  end
63
55
 
64
56
  def fcall?
65
- type == "NODE_FCALL"
57
+ type == :FCALL
66
58
  end
67
59
 
68
60
  def scope?
69
- type == "NODE_SCOPE"
61
+ type == :SCOPE
70
62
  end
71
63
 
72
64
  def const_pair
@@ -1,3 +1,3 @@
1
1
  module ImportAs
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: import_as
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seiei Miyagi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-11 00:00:00.000000000 Z
11
+ date: 2018-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,15 +83,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - ">="
85
85
  - !ruby/object:Gem::Version
86
- version: '0'
86
+ version: 2.6.0
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.7.8
93
+ rubygems_version: 3.0.1
95
94
  signing_key:
96
95
  specification_version: 4
97
96
  summary: 'Add DSL: import { C as C2 }.from "./c.rb"'