Class: MOCO::Activity

Inherits:
BaseEntity show all
Defined in:
lib/moco/entities.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseEntity

#==, #eql?, #hash, #to_h, #to_json

Instance Attribute Details

#activeObject

Returns the value of attribute active.



66
67
68
# File 'lib/moco/entities.rb', line 66

def active
  @active
end

#billableObject

Returns the value of attribute billable.



66
67
68
# File 'lib/moco/entities.rb', line 66

def billable
  @billable
end

#billedObject

Returns the value of attribute billed.



66
67
68
# File 'lib/moco/entities.rb', line 66

def billed
  @billed
end

#customerObject

Returns the value of attribute customer.



66
67
68
# File 'lib/moco/entities.rb', line 66

def customer
  @customer
end

#dateObject

Returns the value of attribute date.



66
67
68
# File 'lib/moco/entities.rb', line 66

def date
  @date
end

#descriptionObject

Returns the value of attribute description.



66
67
68
# File 'lib/moco/entities.rb', line 66

def description
  @description
end

#hoursObject

Returns the value of attribute hours.



66
67
68
# File 'lib/moco/entities.rb', line 66

def hours
  @hours
end

#idObject

Returns the value of attribute id.



66
67
68
# File 'lib/moco/entities.rb', line 66

def id
  @id
end

#projectObject

Returns the value of attribute project.



66
67
68
# File 'lib/moco/entities.rb', line 66

def project
  @project
end

#secondsObject

Returns the value of attribute seconds.



66
67
68
# File 'lib/moco/entities.rb', line 66

def seconds
  @seconds
end

#tagObject

Returns the value of attribute tag.



66
67
68
# File 'lib/moco/entities.rb', line 66

def tag
  @tag
end

#taskObject

Returns the value of attribute task.



66
67
68
# File 'lib/moco/entities.rb', line 66

def task
  @task
end

#userObject

Returns the value of attribute user.



66
67
68
# File 'lib/moco/entities.rb', line 66

def user
  @user
end

Instance Method Details

#to_sObject



69
70
71
72
# File 'lib/moco/entities.rb', line 69

def to_s
  "#{date} - #{hours}h (#{seconds}s) - #{project&.name} - #{task&.name}#{description.empty? ? "" : " (#{description})"} " \
    "(#{%i[billable billed].map { |x| (send(x) ? "" : "not ") + x.to_s }.join(", ")})"
end