Module: TM::Format

Included in:
CSV, Pretty, Table
Defined in:
lib/tm/format/csv.rb,
lib/tm/format/table.rb,
lib/tm/format/format.rb,
lib/tm/format/pretty.rb

Defined Under Namespace

Classes: CSV, Pretty, Table

Constant Summary collapse

PROJECT_KEYS =
%w[id name description created_at updated_at]
TICKET_KEYS =
%w[status priority title resolution assignee requestor project_id]
COMMENT_KEYS =
%w[author body ticket_id]

Instance Method Summary collapse

Instance Method Details

#afterObject



8
# File 'lib/tm/format/format.rb', line 8

def after; end

#before(entity) ⇒ Object



7
# File 'lib/tm/format/format.rb', line 7

def before(entity); end

#normalize_entity(entity) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/tm/format/format.rb', line 10

def normalize_entity(entity) 
  entity.keys.inject({}) do |hash, key|
    if PROJECT_KEYS.include?(key) || TICKET_KEYS.include?(key) || COMMENT_KEYS.include?(key)
      hash[key] = entity[key] 
    end
    hash
  end
end