Class | Limelight::Production |
In: |
lib/limelight/production.rb
|
Parent: | Object |
The root object of Limelight Production. Every Prop in a production has access to its Production object. Therefore it is typical to store reasources in the Production.
Productions are configured, and attributes are added, by the ProductionBuilder.
name | -> | getName |
name | [R] | |
producer | [RW] | |
root | [R] | |
theater | [RW] |
Users typically need not create Production objects.
# File lib/limelight/production.rb, line 36 36: def initialize(path) 37: @root = FileLoader.for_root(path) 38: @name = File.basename(path) 39: end
Returns true if the production allows itself to be closed. The system will call this methods when it wishes to close the production, perhaps when the user quits the application. By default the production will always return true.
# File lib/limelight/production.rb, line 109 109: def allow_close? 110: return true 111: end
returns true if the production has been closed.
# File lib/limelight/production.rb, line 145 145: def closed? 146: return @closed 147: end
Returned the name of the default scene. This is only used when there are not stages defined in the production. Defaults to :root, the production‘s root directory is the default scene. Return nil if there are not defaults.
# File lib/limelight/production.rb, line 173 173: def default_scene 174: return :root 175: end
Returns the minimum version of limelight required to run this production. Default: "0.0.0" If the version of limelight used to open this production is less than the minimum, an error will be displayed (starting with version 0.4.0).
# File lib/limelight/production.rb, line 101 101: def minimum_limelight_version 102: return "0.0.0" 103: end
Sets the name of the Production. The name must be unique amongst all Productions in memory.
# File lib/limelight/production.rb, line 43 43: def name=(value) 44: Context.instance.studio.error_if_duplicate_name(value) 45: @name = value 46: end
Called when the production is fully closed. The default implementation does nothing but you may re-implement it in the production.rb file.
# File lib/limelight/production.rb, line 140 140: def production_closed 141: end
Called when the production is about to be closed. The default implementation does nothing but you may re-implement it in the production.rb file.
# File lib/limelight/production.rb, line 134 134: def production_closing 135: end
Called when the production has been loaded. That is, when all the gems have been loaded stages have been instantiated.
# File lib/limelight/production.rb, line 122 122: def production_loaded 123: end
Called when the production is fully opened. The default implementation does nothing but you may re-implement it in the production.rb file.
# File lib/limelight/production.rb, line 128 128: def production_opened 129: end
Called when the production is about to be opened. The default implementation does nothing but you may re-implement it in the production.rb file.
# File lib/limelight/production.rb, line 116 116: def production_opening 117: end
Publish this production using DRb on the specified port. The production will delegate to its producer to actually do the publishing.
# File lib/limelight/production.rb, line 159 159: def publish_on_drb(port) 160: @producer.publish_production_on_drb(port) 161: end
A production with multiple Scenes may have a ‘styles.rb’ file in the root directory. This is called the root_styles. This method loads the root_styles, if they haven‘t already been loaded, and returns them.
# File lib/limelight/production.rb, line 180 180: def root_styles 181: unless @root_styles 182: if File.exists?(styles_file) 183: @root_styles = Limelight.build_styles_from_file(styles_file) 184: else 185: @root_styles = {} 186: end 187: end 188: return @root_styles 189: end
Returns the path to the named Scene‘s directory within the Production
# File lib/limelight/production.rb, line 92 92: def scene_directory(name) 93: return @root.root if name == :root 94: return @root.path_to(name) 95: end
Called when the last stage in this production‘s theater is closed. If the allow_close? returns true this production will be closed.
# File lib/limelight/production.rb, line 166 166: def theater_empty! 167: close if allow_close? && !closed? 168: end