Class: Cardigan::Command::CreateCard

Inherits:
Object
  • Object
show all
Defined in:
lib/cardigan/command/create_card.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository) ⇒ CreateCard

Returns a new instance of CreateCard.



7
8
9
10
11
# File 'lib/cardigan/command/create_card.rb', line 7

def initialize repository
  @repository = repository
  @usage = '<name>'
  @help = 'Creates a new card with the specified name (without opening it for editing)'
end

Instance Attribute Details

#helpObject (readonly)

Returns the value of attribute help.



5
6
7
# File 'lib/cardigan/command/create_card.rb', line 5

def help
  @help
end

#usageObject (readonly)

Returns the value of attribute usage.



5
6
7
# File 'lib/cardigan/command/create_card.rb', line 5

def usage
  @usage
end

Instance Method Details

#execute(name) ⇒ Object



13
14
15
# File 'lib/cardigan/command/create_card.rb', line 13

def execute name
  @repository[UUIDTools::UUID.random_create.to_s] = {'name' => name }
end