Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Class#inherits_method_missing #676

Merged
merged 2 commits into from
Jun 4, 2018
Merged

Conversation

st0012
Copy link
Member

@st0012 st0012 commented May 26, 2018

By default, method_missing's behavior is non-inheritable in Goby. So the following code will fail

class Foo
  def method_missing(name)
    10
  end
end

class Bar < Foo
end
		
Bar.new.bar #=> NoMethodError

But after this PR, you just need to call inherits_method_missing in the children class (Bar in the example) and then it can inherit method_missing from its ancestors

class Foo
  def method_missing(name)
    10
  end
end

class Bar < Foo
  inherits_method_missing
end
		
Bar.new.bar #=> 10

@st0012 st0012 added this to the version 0.1.10 milestone May 26, 2018
@st0012 st0012 self-assigned this May 26, 2018
@st0012 st0012 requested review from eliothedeman and hachi8833 May 26, 2018 09:27
@ghost ghost added the in progress label May 26, 2018
@codecov
Copy link

codecov bot commented May 26, 2018

Codecov Report

Merging #676 into master will decrease coverage by 0.02%.
The diff coverage is 76.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #676      +/-   ##
==========================================
- Coverage   81.86%   81.84%   -0.03%     
==========================================
  Files          57       57              
  Lines        7727     7749      +22     
==========================================
+ Hits         6326     6342      +16     
- Misses       1132     1136       +4     
- Partials      269      271       +2
Impacted Files Coverage Δ
vm/object.go 83.01% <100%> (+1.01%) ⬆️
vm/instruction.go 92.6% <100%> (ø) ⬆️
vm/class.go 84.11% <68.42%> (-0.5%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd19b03...eab8adf. Read the comment docs.

@st0012 st0012 merged commit 382fc7d into master Jun 4, 2018
@ghost ghost removed the in progress label Jun 4, 2018
@st0012 st0012 deleted the Support-inheritable-method-missing branch June 4, 2018 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant