Class: CardPrinter::Story

Inherits:
Object
  • Object
show all
Defined in:
lib/card_printer/story.rb

Constant Summary collapse

ATTRS =

story_type = feature|bug|chore|other

[:name, :description, :story_type, :estimate, :label, :id]

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Story



9
10
11
12
13
# File 'lib/card_printer/story.rb', line 9

def initialize(data = {})
  ATTRS.each do |attr_name|
    self.send(:"#{attr_name}=", data[attr_name] || data[attr_name.to_s])
  end
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/card_printer/story.rb', line 15

def to_s
  Hash[ATTRS.map {|a| [a, self.send(a)] }].to_s
end