Sha256: 6c9a9c2237c95cf648c6e73bcdf52eb642b3b348fa01181890e3e2cb3c43abbb

Contents?: true

Size: 1.25 KB

Versions: 19

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require_relative 'affixes'
require_relative 'adapters'

module NanoBot
  module Logic
    module Cartridge
      module Interaction
        def self.input(cartridge, interface, content)
          lua = Adapter.expression(cartridge, interface, :input, :lua)
          fennel = Adapter.expression(cartridge, interface, :input, :fennel)
          clojure = Adapter.expression(cartridge, interface, :input, :clojure)

          prefix = Affixes.get(cartridge, interface, :input, :prefix)
          suffix = Affixes.get(cartridge, interface, :input, :suffix)

          { content:, prefix:, suffix:, lua:, fennel:, clojure: }
        end

        def self.output(cartridge, interface, result, streaming, _finished)
          if streaming
            result[:message] = { content: result[:message], lua: nil, fennel: nil, clojure: nil }
            return result
          end

          lua = Adapter.expression(cartridge, interface, :output, :lua)
          fennel = Adapter.expression(cartridge, interface, :output, :fennel)
          clojure = Adapter.expression(cartridge, interface, :output, :clojure)

          result[:message] = { content: result[:message], lua:, fennel:, clojure: }

          result
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
nano-bots-3.4.0 logic/cartridge/interaction.rb
nano-bots-3.3.0 logic/cartridge/interaction.rb
nano-bots-3.2.0 logic/cartridge/interaction.rb
nano-bots-3.0.1 logic/cartridge/interaction.rb
nano-bots-3.0.0 logic/cartridge/interaction.rb
nano-bots-2.5.1 logic/cartridge/interaction.rb
nano-bots-2.5.0 logic/cartridge/interaction.rb
nano-bots-2.4.1 logic/cartridge/interaction.rb
nano-bots-2.4.0 logic/cartridge/interaction.rb
nano-bots-2.3.0 logic/cartridge/interaction.rb
nano-bots-2.2.0 logic/cartridge/interaction.rb
nano-bots-2.1.0 logic/cartridge/interaction.rb
nano-bots-2.0.0 logic/cartridge/interaction.rb
nano-bots-1.2.0 logic/cartridge/interaction.rb
nano-bots-1.1.2 logic/cartridge/interaction.rb
nano-bots-1.1.1 logic/cartridge/interaction.rb
nano-bots-1.1.0 logic/cartridge/interaction.rb
nano-bots-1.0.1 logic/cartridge/interaction.rb
nano-bots-1.0.0 logic/cartridge/interaction.rb