class Xcplayground::SwiftFile
Represent a Swift language file on disc
Attributes
content[RW]
filename[RW]
Public Class Methods
new(filename, content = nil)
click to toggle source
# File lib/xcplayground/swift_file.rb, line 7 def initialize(filename, content = nil) @filename = filename @content = content end
Public Instance Methods
save(path)
click to toggle source
# File lib/xcplayground/swift_file.rb, line 12 def save(path) file = File.join(path, filename) File.open(file, 'w') do |f| f.puts to_s end end
to_s()
click to toggle source
# File lib/xcplayground/swift_file.rb, line 19 def to_s @content || '//: Playground - noun: a place where people can play' end