Class: AdminEditorPage::Editor
- Inherits:
-
Object
- Object
- AdminEditorPage::Editor
- Defined in:
- lib/models/admin_editor_page.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #edit(site) ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(name, command) ⇒ Editor
constructor
A new instance of Editor.
- #path ⇒ Object
Constructor Details
#initialize(name, command) ⇒ Editor
Returns a new instance of Editor.
8 9 10 11 |
# File 'lib/models/admin_editor_page.rb', line 8 def initialize(name, command) @name = name @command = command end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
4 5 6 |
# File 'lib/models/admin_editor_page.rb', line 4 def command @command end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/models/admin_editor_page.rb', line 4 def name @name end |
Instance Method Details
#edit(site) ⇒ Object
7 |
# File 'lib/models/admin_editor_page.rb', line 7 def edit(site); `#{path} #{site.root_directory}`; end |
#exists? ⇒ Boolean
5 |
# File 'lib/models/admin_editor_page.rb', line 5 def exists?; path.present?; end |
#path ⇒ Object
6 |
# File 'lib/models/admin_editor_page.rb', line 6 def path; @path ||= `which #{@command}`.strip; end |