Class: TrelloCli::Formatters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/trello_cli/formatters/base.rb

Direct Known Subclasses

BoardList, CardCreate, CardList, CardMove, ListList

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/trello_cli/formatters/base.rb', line 6

def initialize(data)
  @data = data
end

Instance Method Details

#output(format) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/trello_cli/formatters/base.rb', line 10

def output(format)
  case format
  when "json"
    self.to_json
  when "tsv"
    self.to_tsv
  else
    self.to_legacy
  end
end

#to_jsonObject



21
22
23
# File 'lib/trello_cli/formatters/base.rb', line 21

def to_json
  data.to_json
end