Sha256: 2882d26728e5a0b2d6101fee55a982cf3cffbf829551878ed3590d50f50c883f

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require "converse/comms/simple_logger"

module Converse

  class Interaction
    attr_accessor :broker
    attr_accessor :concern
    attr_accessor :action
    attr_accessor :substance
    attr_accessor :conversation
    attr_accessor :should_i_ask

    def discuss_with_broker_concerning(broker, concern)
      discuss_with(broker)
      concerning(concern)
    end

    def discuss_with(broker)
      @broker = broker
    end

    def concerning(concern)
      @concern = concern.dup
    end

    def about(action)
      @action = action.dup
    end

    def detailed_by(substance)
      @substance = substance
    end

    def by_asking
      @should_i_ask = true
    end

    def by_saying
      @should_i_ask = false
    end

    def ask
      @conversation.ask
    end

    def say
      @conversation.say
    end

    def discuss
      @conversation = broker.broker_conversation(@broker.open_topic(@concern, @action))
      @conversation.subscribe(SimpleLogger.new)
      @should_i_ask ? response = ask : response = say
      interpret_conversation(response)
    end

    def interpret_conversation(response)
      response
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
converse-1.0.8 lib/converse/interaction.rb
converse-1.0.7 lib/converse/interaction.rb
converse-1.0.6 lib/converse/interaction.rb
converse-1.0.5 lib/converse/interaction.rb