Sorry I was on multiple machines and I turned off the one I was working on before I realized I could have submitted a PR (and you were not on IRC):
java_import Java::javafx.beans.binding.StringBinding
class RubyStringBinding < StringBinding
def initialize(property:, method:)
super()
@property, @method = property, method
bind @property
end
def computeValue
property_value = @property.get
return unless property_value
property_value.__send__ @method
end
end
So this works fine and you adapter this pattern for all basic types of Binding (although to be honest with type erasure you can probably use this class for any Java type since they all end up as Object).
Sorry I was on multiple machines and I turned off the one I was working on before I realized I could have submitted a PR (and you were not on IRC):
So this works fine and you adapter this pattern for all basic types of Binding (although to be honest with type erasure you can probably use this class for any Java type since they all end up as Object).