Sha256: 3b539024ac5529a66a732c288cc09b23efe638645dd88d1c0726bb6f9e66a823

Contents?: true

Size: 966 Bytes

Versions: 23

Compression:

Stored size: 966 Bytes

Contents

module Fortitude
  module Rails
    YIELDED_OBJECT_OUTPUTTER_SUPERCLASS = if defined?(::BasicObject) then ::BasicObject else ::Object end
    class YieldedObjectOutputter < YIELDED_OBJECT_OUTPUTTER_SUPERCLASS
      def initialize(widget, yielded_object, method_names)
        @widget = widget
        @yielded_object = yielded_object
        @method_names_hash = { }
        method_names.each do |method_name|
          @method_names_hash[method_name.to_sym] = true
        end
      end

      EMPTY_RETURN_VALUE = ''.freeze

      def method_missing(method_name, *args, &block)
        return_value = @yielded_object.send(method_name, *args, &block)
        if @method_names_hash[method_name.to_sym]
          @widget.rawtext(return_value)
          EMPTY_RETURN_VALUE
        else
          return_value
        end
      end

      def respond_to?(symbol, include_all = false)
        @yielded_object.respond_to?(symbol, include_all)
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
fortitude-0.9.3-java lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.9.3 lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.9.2-java lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.9.2 lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.9.1-java lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.9.1 lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.9.0-java lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.9.0 lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.10-java lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.10 lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.9-java lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.9 lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.7-java lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.7 lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.6-java lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.6 lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.5-java lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.5 lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.4-java lib/fortitude/rails/yielded_object_outputter.rb
fortitude-0.0.4 lib/fortitude/rails/yielded_object_outputter.rb