Sha256: 3700e3983b9aaba7934a84977cdce77b59696af12b0d6aa4fc44314e91b6a899

Contents?: true

Size: 901 Bytes

Versions: 3

Compression:

Stored size: 901 Bytes

Contents

module Pione
  module CommandOption
    module TupleSpaceProviderOption
      extend OptionInterface
      use_option_module PresenceNotifierOption

      # --presence-notification-address
      define_option(
        "--presence-notification-address=255.255.255.255:%s" % Global.presence_port,
        "set the address for sending presence notifier"
      ) do |address|
        # clear addresses at first time
        unless @__option_notifier_address__
          @__option_notifier_address__ = true
          Global.presence_notification_addresses = []
        end
        # add the address
        address = address =~ /^broadcast/ ? address : "broadcast://%s" % address
        uri = URI.parse(address)
        uri.host = "255.255.255.255" if uri.host.nil?
        uri.port = Global.presence_port if uri.port.nil?
        Global.presence_notification_addresses << uri
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pione-0.1.2 lib/pione/command-option/tuple-space-provider-option.rb
pione-0.1.1 lib/pione/command-option/tuple-space-provider-option.rb
pione-0.1.0 lib/pione/command-option/tuple-space-provider-option.rb