Class: Flagsmith::Engine::Feature

Inherits:
Object
  • Object
show all
Defined in:
lib/flagsmith/engine/features/models.rb

Overview

FeatureModel

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, type:) ⇒ Feature

Returns a new instance of Feature.



94
95
96
97
98
# File 'lib/flagsmith/engine/features/models.rb', line 94

def initialize(id:, name:, type:)
  @id = id
  @name = name
  @type = type
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



92
93
94
# File 'lib/flagsmith/engine/features/models.rb', line 92

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



92
93
94
# File 'lib/flagsmith/engine/features/models.rb', line 92

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



92
93
94
# File 'lib/flagsmith/engine/features/models.rb', line 92

def type
  @type
end

Class Method Details

.build(json) ⇒ Object



107
108
109
# File 'lib/flagsmith/engine/features/models.rb', line 107

def build(json)
  new(**json.slice(:id, :name, :type))
end

Instance Method Details

#==(other) ⇒ Object



100
101
102
103
104
# File 'lib/flagsmith/engine/features/models.rb', line 100

def ==(other)
  return false if other.nil?

  id == other.id
end