Skip to content

HEH. Solution in Ruby #2

@enebo

Description

@enebo

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions