Class: Cardigan::EntryContext

Inherits:
Object
  • Object
show all
Includes:
ShellShock::Context
Defined in:
lib/cardigan/entry_context.rb

Instance Method Summary collapse

Constructor Details

#initialize(io, workflow_repository, entry) ⇒ EntryContext

Returns a new instance of EntryContext.



8
9
10
11
12
13
14
15
16
17
# File 'lib/cardigan/entry_context.rb', line 8

def initialize io, workflow_repository, entry
  @io, @workflow_repository, @entry = io, workflow_repository, entry
  @prompt_text = "#{File.expand_path('.').split('/').last.slice(0..0)}/#{entry['name']} > "
  @commands = {
    'now'  => Command.load(:change_status, @entry, @workflow_repository),
    'set'  => Command.load(:change_value, @entry, @io),
    'edit' => Command.load(:edit_value, @entry, @io),
    'ls' => Command.load(:show_entry, @entry, @io)
  }
end