Class: Atatus::Context::Company Private

Inherits:
Object
  • Object
show all
Defined in:
lib/atatus/context/company.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil) ⇒ Company

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Company.



7
8
9
# File 'lib/atatus/context/company.rb', line 7

def initialize(id: nil)
  @id = id
end

Instance Attribute Details

#idObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
# File 'lib/atatus/context/company.rb', line 19

def id
  @id
end

Class Method Details

.infer(config, record) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
14
15
16
17
# File 'lib/atatus/context/company.rb', line 11

def self.infer(config, record)
  return unless record

  new(
    id: safe_get(record, config.current_company_id_method)&.to_s
  )
end

Instance Method Details

#any?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


25
26
27
# File 'lib/atatus/context/company.rb', line 25

def any?
  !empty?
end

#empty?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


21
22
23
# File 'lib/atatus/context/company.rb', line 21

def empty?
  !id
end