Class: AdminEditorPage::Editor

Inherits:
Object
  • Object
show all
Defined in:
lib/models/admin_editor_page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandObject (readonly)

Returns the value of attribute command.



4
5
6
# File 'lib/models/admin_editor_page.rb', line 4

def command
  @command
end

#nameObject (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

Returns:

  • (Boolean)


5
# File 'lib/models/admin_editor_page.rb', line 5

def exists?; path.present?; end

#pathObject



6
# File 'lib/models/admin_editor_page.rb', line 6

def path; @path ||= `which #{@command}`.strip; end