close
Skip to main content

New answers tagged

Score of 1
Accepted

Get the return type of a method based on fully qualified class name, method name, and method parameter types

The Scala reflection API can do this while preserving the actual Scala types (Int rather than the erased int, which is what the Java reflection API would report): import scala.reflect.runtime.{...
Score of 0

Get the return type of a method based on fully qualified class name, method name, and method parameter types

Use Scala reflection to get the MethodSymbol and inspect its returnType. For multiple parameter groups, match against paramLists rather than treating all parameters as one list. If you only need the ...
Score of 1

Git - how do I view the change history of a method/function?

In my case, I wanted to trace the evolution of a protobuf message (~a struct), so only a regexp helped: it carves out a portion of the diff starting with message StructName { ending with } within a ...
Score of -1

Automatically set instance variable as method argument?

method(:initialize).parameters.map { |_, arg| eval("@#{arg} = #{arg}", binding, __FILE__, __LINE__) }

Top 50 recent answers are included