Class: Makitoo::FeatureFlag::User

Inherits:
Object
  • Object
show all
Defined in:
lib/makitoo/feature_flag/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, attributes = {}) ⇒ User

Returns a new instance of User.



8
9
10
11
# File 'lib/makitoo/feature_flag/user.rb', line 8

def initialize(id, attributes = {})
  @id = id
  @attributes = attributes
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/makitoo/feature_flag/user.rb', line 6

def id
  @id
end

Class Method Details

.of(string_or_user) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/makitoo/feature_flag/user.rb', line 19

def self.of(string_or_user)
  if string_or_user.is_a? String
    User.new(string_or_user)
  else
    string_or_user
  end
end

Instance Method Details

#as_json(options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/makitoo/feature_flag/user.rb', line 13

def as_json(options = {})
  result = @attributes.clone
  result[:id] = @id
  result
end