Module: EpubForge::Action::SharedActionInterface
- Included in:
- Action
- Defined in:
- lib/epubforge/action/action.rb
Instance Method Summary collapse
-
#desc(usage, description, options = {}) ⇒ Object
eventually replace description.
- #include_standard_options ⇒ Object
-
#project_not_required ⇒ Object
Most actions require – nay, demand! – a project to act upon.
-
#project_required? ⇒ Boolean
def keyword( k = nil ) @keyword = k unless k.nil? @keyword end.
Instance Method Details
#desc(usage, description, options = {}) ⇒ Object
eventually replace description
44 45 46 47 48 49 50 51 52 |
# File 'lib/epubforge/action/action.rb', line 44 def desc( usage, description, = {} ) verbose = defined?(EpubForge::Action::Character) && self == EpubForge::Action::Character puts "--------------IN DESC()----------------" if verbose puts self..inspect if verbose self.command_to_action_classes[usage] = self super( usage, description, ) puts self..inspect if verbose puts "--------------END DESC()----------------" if verbose end |
#include_standard_options ⇒ Object
93 94 95 96 97 98 |
# File 'lib/epubforge/action/action.rb', line 93 def method_option :verbose, :type => :boolean, :default => false, :aliases => "-v" method_option :debug, :type => :boolean, :default => false, :aliases => "--dbg" method_option :help, :type => :boolean, :default => false, :aliases => "-h" method_option :project, :type => :string, :default => nil, :aliases => "--proj" end |
#project_not_required ⇒ Object
Most actions require – nay, demand! – a project to act upon. Add the line ‘project_not_required’ to the class definition to keep it from failing out if it can’t find an existing project. Used for things like initializing new projects, or… my imagination fails me.
89 90 91 |
# File 'lib/epubforge/action/action.rb', line 89 def project_not_required @project_required = false end |
#project_required? ⇒ Boolean
def keyword( k = nil )
@keyword = k unless k.nil?
@keyword
end
def usage( str = nil )
@usage = str if str
@usage
end
79 80 81 82 |
# File 'lib/epubforge/action/action.rb', line 79 def project_required? @project_required = true if @project_required.nil? @project_required end |