Class: Smplkit::FlagDeclaration

Inherits:
Object
  • Object
show all
Defined in:
lib/smplkit/flags/types.rb

Overview

Describes a flag declaration for buffered registration.

Used by client.flags.register to queue declarations for bulk registration. service and environment default to nil; the client fills them from the active Smplkit::Client when it forwards declarations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, type:, default:, service: nil, environment: nil) ⇒ FlagDeclaration

Returns a new instance of FlagDeclaration.



150
151
152
153
154
155
156
157
# File 'lib/smplkit/flags/types.rb', line 150

def initialize(id:, type:, default:, service: nil, environment: nil)
  @id = id
  @type = type
  @default = default
  @service = service
  @environment = environment
  freeze
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



148
149
150
# File 'lib/smplkit/flags/types.rb', line 148

def default
  @default
end

#environmentObject (readonly)

Returns the value of attribute environment.



148
149
150
# File 'lib/smplkit/flags/types.rb', line 148

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



148
149
150
# File 'lib/smplkit/flags/types.rb', line 148

def id
  @id
end

#serviceObject (readonly)

Returns the value of attribute service.



148
149
150
# File 'lib/smplkit/flags/types.rb', line 148

def service
  @service
end

#typeObject (readonly)

Returns the value of attribute type.



148
149
150
# File 'lib/smplkit/flags/types.rb', line 148

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



159
160
161
162
# File 'lib/smplkit/flags/types.rb', line 159

def ==(other)
  other.is_a?(FlagDeclaration) && id == other.id && type == other.type && default == other.default &&
    service == other.service && environment == other.environment
end

#hashObject



165
# File 'lib/smplkit/flags/types.rb', line 165

def hash = [id, type, default, service, environment].hash