Parent

DNSSD::Flags

Flags used in DNSSD Ruby API.

Constants

ALL_FLAGS

Bitfield with all valid flags set

Public Class Methods

new(*flags) click to toggle source

Returns a new set of flags

    # File lib/dnssd/flags.rb, line 33
33:   def initialize(*flags)
34:     @flags = flags.inject 0 do |flag, acc| flag | acc end
35: 
36:     verify
37:   end

Public Instance Methods

&(flags) click to toggle source

Returns the intersection of flags in self and flags.

    # File lib/dnssd/flags.rb, line 42
42:   def &(flags)
43:     self.class.new(to_i & flags.to_i)
44:   end
==(other) click to toggle source

self is equal if other has the same flags

    # File lib/dnssd/flags.rb, line 49
49:   def ==(other)
50:     to_i == other.to_i
51:   end
clear_flag(flag) click to toggle source

Clears flag

    # File lib/dnssd/flags.rb, line 56
56:   def clear_flag(flag)
57:     @flags &= ~flag
58: 
59:     verify
60:   end
set_flag(flag) click to toggle source

Sets flag

    # File lib/dnssd/flags.rb, line 71
71:   def set_flag(flag)
72:     @flags |= flag
73: 
74:     verify
75:   end
to_a() click to toggle source

Returns an Array of flag names

    # File lib/dnssd/flags.rb, line 80
80:   def to_a
81:     FLAGS.map do |name, value|
82:       (@flags & value == value) ? name : nil
83:     end.compact
84:   end
to_i() click to toggle source

Flags as a bitfield

    # File lib/dnssd/flags.rb, line 89
89:   def to_i
90:     @flags
91:   end
verify() click to toggle source

Trims the flag list down to valid flags

     # File lib/dnssd/flags.rb, line 96
 96:   def verify
 97:     @flags &= ALL_FLAGS
 98: 
 99:     self
100:   end
|(flags) click to toggle source

Returns the union of flags in self and flags

     # File lib/dnssd/flags.rb, line 105
105:   def |(flags)
106:     self.class.new(to_i | flags.to_i)
107:   end
~() click to toggle source

Returns the complement of the flags in self

     # File lib/dnssd/flags.rb, line 112
112:   def ~
113:     self.class.new ~to_i
114:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.