what_dya_return 0.2.0 → 0.2.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: 8b901658269a99b9dde7f5962dc897a168e671fa91c278eb6172c9f7e774ab75
4
- data.tar.gz: 4570ad3cfcc23332ee91170ddcd08b68502f3e10820c0a5d2f91ad1f39591e6d
3
+ metadata.gz: 3de4d93782243ac22ab3781e0959bf304ab9b98efa92991b453d67894e1c59b8
4
+ data.tar.gz: 1e4152cdf2f48a459197dc718cd8488046de245d7f2f14265878145cb6f1c50d
5
5
  SHA512:
6
- metadata.gz: 1271b830e730bad853f94a84df88f15bd6d914ca5dd47a43a0708ae48021d7943766a9636bebd038846ba230e0c5d2fd3c593d05f7ad1aa0f2cd1f49cae6a0b6
7
- data.tar.gz: c8614901b3d93b637d7035eec6d4ef2d4a062d7072b831ec5d7ad0d060515ff18e01db4987d6eb24ed62a0d483def6789e891d3046f13edb2cbbb42e5645bd47
6
+ metadata.gz: df316fd95cd034fd7b08c9a73c8cc306e307d6f16f8ebe62b2fdc1ba58af2f7abd23d4d8ae1af67b6ea9cf6d9d995c271370219dff0f435cc53a360766d22489
7
+ data.tar.gz: abeabcf9cb05f5a9610229a1c9542bad5b81e2a1bb506f37bcdb935d152190cbf94b004d32bd27dfa323039523e97b27caec0cb4583155eba03f2cef1f402f53
@@ -27,7 +27,9 @@ module WhatDyaReturn
27
27
  #
28
28
  def extract(source_code)
29
29
  processed = AST::ProcessedSource.new(source_code, RUBY_VERSION.to_f)
30
+
30
31
  raise WhatDyaReturn::SyntaxError unless processed.valid_syntax?
32
+ raise WhatDyaReturn::ArgumentError if processed.ast.type != :def
31
33
 
32
34
  Processor.new.process(processed.ast).map do |node|
33
35
  node.nil? ? 'nil' : Unparser.unparse(node)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WhatDyaReturn
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
@@ -8,4 +8,5 @@ module WhatDyaReturn
8
8
  class Error < StandardError; end
9
9
  class SyntaxError < Error; end
10
10
  class UnintentionalNodeError < Error; end
11
+ class ArgumentError < Error; end
11
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: what_dya_return
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wataru MIYAGUNI