class Ducktape::BindingSource

Constants

PROPAGATE_TO_SOURCE
PROPAGATE_TO_TARGET

Attributes

converter[R]
mode[R]
path[R]
source[R]

Public Class Methods

new(source, path, mode = :both, converter = Converter) click to toggle source
# File lib/ducktape/binding_source.rb, line 11
def initialize(source, path, mode = :both, converter = Converter)
  @source, @path, @mode = source, path, mode
  @converter = make_converter(converter)
end

Public Instance Methods

forward?() click to toggle source
# File lib/ducktape/binding_source.rb, line 16
def forward?
  PROPAGATE_TO_TARGET.include?(@mode)
end
reverse?() click to toggle source
# File lib/ducktape/binding_source.rb, line 20
def reverse?
  PROPAGATE_TO_SOURCE.include?(@mode)
end

Private Instance Methods

make_converter(c) click to toggle source
# File lib/ducktape/binding_source.rb, line 25
def make_converter(c)
  case c
    when nil then Converter
    when Class then (c.respond_to?(:convert) && c.respond_to?(:revert)) ? c : c.new
    when Proc, Method, Array then Converter.new(*c)
    else c
  end
end