lib/sheet/open.rb in sheet-0.2.0 vs lib/sheet/open.rb in sheet-0.2.1
- old
+ new
@@ -1,31 +1,28 @@
class Sheet
-
class Open
-
attr_accessor :name
def initialize(name)
@name = name
end
def open
if Sheet.sheet_exists?(name)
process_sheet_content
else
- Sheet.write "A cheat named #{name} doesn't exist.\nYou can create one with sheet new #{name}"
+ Sheet.display "A cheat named #{name} doesn't exist.\nYou can create one with sheet new #{name}"
end
end
private
-
def process_sheet_content
if !sheet_urls.empty? && cmd = Sheet.open_command
sheet_urls.each do |url|
Sheet.exec "#{cmd} #{url.chomp.sub(/url: /,'')}"
end
else
- Sheet.write sheet_content
+ Sheet.display sheet_content
end
end
def sheet_content
@sheet_content ||= File.read(Sheet.sheet_path(name))