class Computering::Dsl::Link
Public Class Methods
from_text(text, link)
click to toggle source
# File lib/computering/dsl/link.rb, line 3 def self.from_text(text, link) Array(self.new text, link) end
new(text, link)
click to toggle source
Calls superclass method
# File lib/computering/dsl/link.rb, line 7 def initialize(text, link) super text @link = link end
Public Instance Methods
execute()
click to toggle source
# File lib/computering/dsl/link.rb, line 12 def execute `#{command_by_os} '#{@link}'` rescue @buffer = add_style($!.message, :error) end
Protected Instance Methods
text_with_style(text, index)
click to toggle source
# File lib/computering/dsl/link.rb, line 20 def text_with_style(text, index) text = add_style(text, :text) if index == 0 || index == (0..-1) text = " #{add_style('☞', :cursor)} #{text}" end text end
Private Instance Methods
command_by_os()
click to toggle source
# File lib/computering/dsl/link.rb, line 30 def command_by_os if (/linux/ =~ RUBY_PLATFORM) "xdg-open" else "open" end end