Class: MM::Console::SimpleCommand::Open
- Inherits:
-
Object
- Object
- MM::Console::SimpleCommand::Open
- Includes:
- Base
- Defined in:
- lib/mm/console/simple_command/open.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute(runtime) ⇒ Object
-
#initialize(input = '') ⇒ Open
constructor
A new instance of Open.
Methods included from Base
Constructor Details
#initialize(input = '') ⇒ Open
Returns a new instance of Open.
15 16 17 |
# File 'lib/mm/console/simple_command/open.rb', line 15 def initialize(input='') @input = input.gsub(/^open/, '').strip end |
Class Method Details
.doc(runtime) ⇒ Object
11 12 13 |
# File 'lib/mm/console/simple_command/open.rb', line 11 def self.doc(runtime) "Open card, view or your context(card or view) in your default browser. This command sends 'open 'http:/project_url' to your Terminal, which may not work in Windows." end |
.keys ⇒ Object
7 8 9 |
# File 'lib/mm/console/simple_command/open.rb', line 7 def self.keys ['open( (.+))?'] end |
Instance Method Details
#execute(runtime) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/mm/console/simple_command/open.rb', line 19 def execute(runtime) unless @input.blank? resource = @input =~ /^#(\d+)$/ ? MM::Console::Card.new($1) : MM::Console::View.new(@input) resource.execute(runtime) end runtime[:context].open(runtime) end |