Class: TheFox::Wallet::Command
- Inherits:
-
Object
- Object
- TheFox::Wallet::Command
show all
- Defined in:
- lib/wallet/command.rb
Constant Summary
collapse
- NAME =
'default'
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = Hash.new) ⇒ Command
Returns a new instance of Command.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/wallet/command.rb', line 14
def initialize(options = Hash.new)
@options = options
@options[:logger] ||= Logger.new(IO::NULL)
@options[:wallet_path] ||= Pathname.new('wallet')
@options[:entry_id] ||= nil
@options[:entry_title] ||= nil
@options[:entry_date] ||= Date.today.to_s
@options[:entry_date_start] ||= Date.parse('1970-01-01')
@options[:entry_date_end] ||= Date.today
@options[:entry_revenue] ||= 0.0
@options[:entry_expense] ||= 0.0
@options[:entry_category] ||= nil
@options[:entry_comment] ||= nil
@options[:is_import] ||= false
@options[:is_export] ||= false
@options[:path] ||= nil
@options[:is_interactively] ||= false
@options[:force] ||= false
end
|
Class Method Details
.create_by_name(name, options = Hash.new) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/wallet/command.rb', line 38
def self.create_by_name(name, options = Hash.new)
classes = [
AddCommand,
CategoriesCommand,
ClearCommand,
CsvCommand,
HtmlCommand,
ListCommand,
]
classes.each do |cclass|
if cclass.is_matching_class(name)
cmd = cclass.new(options)
return cmd
end
end
raise "Unknown command '#{name}'"
end
|
.is_matching_class(name) ⇒ Object
60
61
62
|
# File 'lib/wallet/command.rb', line 60
def self.is_matching_class(name)
name == self::NAME
end
|
Instance Method Details
#run ⇒ Object
35
36
|
# File 'lib/wallet/command.rb', line 35
def run
end
|