Permalink
Browse files

Improve IEX's s helper implementation

  • Loading branch information...
1 parent 295d275 commit 0f9b717c03acccf7416b02ae1674a9d48241fe1b @yrashk yrashk committed Dec 2, 2012
Showing with 6 additions and 10 deletions.
  1. +6 −10 lib/iex/lib/iex/helpers.ex
View
@@ -369,18 +369,14 @@ defmodule IEx.Helpers do
@doc false
def s(module, function, arity) do
- case Enum.filter(beam_specs(module),
- fn({_type, {{f,a}, _value}}) ->
- f == function and a == arity
- end) do
- [spec] -> :ok
- _ -> spec = nil
+ specs = lc {_kind, {{f, a}, _spec}} = spec inlist beam_specs(module),
+ f == function and a == arity do
+ print_spec(spec)
+ spec
end
- if spec do
- print_spec(spec)
- else
- IO.puts "No specs for #{inspect module}.#{function}/#{arity} have been found"
+ if specs == [] do
+ IO.puts "No specs for #{inspect module}.#{function} have been found"
end
:ok

0 comments on commit 0f9b717

Please sign in to comment.