Class: Xcplayground::Playground
- Inherits:
-
Object
- Object
- Xcplayground::Playground
- Defined in:
- lib/xcplayground/playground.rb
Overview
Represents a .playground file
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#playground_file ⇒ Object
readonly
Returns the value of attribute playground_file.
-
#source_files ⇒ Object
Returns the value of attribute source_files.
-
#swift_file ⇒ Object
readonly
Returns the value of attribute swift_file.
-
#timeline_file ⇒ Object
readonly
Returns the value of attribute timeline_file.
Instance Method Summary collapse
-
#initialize(path, platform = :ios) ⇒ Playground
constructor
A new instance of Playground.
- #save ⇒ Object
Constructor Details
#initialize(path, platform = :ios) ⇒ Playground
Returns a new instance of Playground.
10 11 12 13 14 15 16 |
# File 'lib/xcplayground/playground.rb', line 10 def initialize(path, platform = :ios) @path = File.(path) @swift_file = SwiftFile.new('contents.swift') @timeline_file = XctimelineFile.new @playground_file = XcplaygroundFile.new(platform) @source_files = [SwiftFile.new('SupportCode.swift')] end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/xcplayground/playground.rb', line 8 def path @path end |
#playground_file ⇒ Object (readonly)
Returns the value of attribute playground_file.
8 9 10 |
# File 'lib/xcplayground/playground.rb', line 8 def playground_file @playground_file end |
#source_files ⇒ Object
Returns the value of attribute source_files.
7 8 9 |
# File 'lib/xcplayground/playground.rb', line 7 def source_files @source_files end |
#swift_file ⇒ Object (readonly)
Returns the value of attribute swift_file.
8 9 10 |
# File 'lib/xcplayground/playground.rb', line 8 def swift_file @swift_file end |
#timeline_file ⇒ Object (readonly)
Returns the value of attribute timeline_file.
8 9 10 |
# File 'lib/xcplayground/playground.rb', line 8 def timeline_file @timeline_file end |
Instance Method Details
#save ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/xcplayground/playground.rb', line 18 def save # Make the playground container directory FileUtils.mkdir_p(path) # Save the timeline and playground files [timeline_file, playground_file, swift_file].each { |f| f.save(path) } # Save the additional source files save_sources end |