Sha256: d5e2daba321cc7bd7e99c6919c8ec1f38047a142647ecb759f6229b0226dd20f

Contents?: true

Size: 488 Bytes

Versions: 6

Compression:

Stored size: 488 Bytes

Contents

module Bogus
  class InteractionPresenter
    extend Bogus::Takes

    takes :interaction

    def to_s
      "##{interaction.method}(#{args})#{result}"
    end

    private

    def args
      interaction.args.map(&:inspect).join(', ')
    end

    def result
      error || return_value
    end

    def return_value
      " => #{interaction.return_value.inspect}" if interaction.has_result
    end

    def error
      " !! #{interaction.error}" if interaction.error
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bogus-0.0.4 lib/bogus/interaction_presenter.rb
bogus-0.0.3 lib/bogus/interaction_presenter.rb
bogus-0.0.3.rc.2 lib/bogus/interaction_presenter.rb
bogus-0.0.3.rc.1 lib/bogus/interaction_presenter.rb
bogus-0.0.2 lib/bogus/interaction_presenter.rb
bogus-0.0.1 lib/bogus/interaction_presenter.rb