Sha256: 3f98ed2337277c7b52a6dade587f004ac089fd975109ee9acd7705f8df52007b

Contents?: true

Size: 1.27 KB

Versions: 11

Compression:

Stored size: 1.27 KB

Contents

Mite.class_eval do
  def self.account_url
    host_format % [protocol, domain_format % account, (port.blank? ? '' : ":#{port}")]
  end
end

Mite::TimeEntry.class_eval do
  # I need the full class path, otherwise there will be LoadErrors
  def service
    @service ||= Mite::Service.find(service_id) unless service_id.blank?
  end
  
  # I need the full class path, otherwise there will be LoadErrors
  def project
    @project ||= Mite::Project.find(project_id) unless project_id.blank?
  end

  def inspect
    output = []
    output << formatted_time.colorize(tracking? ? :lightyellow : :lightred)
    output << formatted_revenue.colorize(:lightgreen) if revenue
    output << "\tdoing #{service.name}" if service
    output << "\tfor #{project.name}" if project
    output << "\n\t\t|_ #{note}" unless note.blank?
    output.join(' ')
  end
  
  def formatted_revenue
    revenue.nil? ? '' : "%.2f $" % (revenue / 100.0)
  end
    
  def formatted_time
    minutes = tracking? ? tracker.minutes : self.minutes
    if minutes > 59
      h = minutes/60
      m = minutes-h*60
      "#{h}:%.2d" % m
    else
      "0:%.2d" % minutes
    end
  end

end

Mite::Tracker.class_eval do
  def time_entry
    @time_entry ||= Mite::TimeEntry.find(id)
  end

  def inspect
    time_entry.inspect
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
Overbryd-mighty-mite-0.1.0 lib/mite_ext.rb
Overbryd-mighty-mite-0.1.1 lib/mite_ext.rb
Overbryd-mighty-mite-0.1.2 lib/mite_ext.rb
Overbryd-mighty-mite-0.1.3 lib/mite_ext.rb
Overbryd-mite.cmd-0.1.3 lib/mite_ext.rb
Overbryd-mite.cmd-0.1.4 lib/mite_ext.rb
Overbryd-mite.cmd-0.1.5 lib/mite_ext.rb
Overbryd-mite.cmd-0.1.7 lib/mite_ext.rb
Overbryd-mite.cmd-0.1.9 lib/mite_ext.rb
mite.cmd-0.1.12 lib/mite_ext.rb
mite.cmd-0.1.10 lib/mite_ext.rb