Class: ShipBuilder
- Inherits:
-
Object
- Object
- ShipBuilder
- Includes:
- Blueprints
- Defined in:
- lib/uss-enterprise/ship_builders.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#available_blueprints ⇒ Object
readonly
Returns the value of attribute available_blueprints.
-
#blueprint ⇒ Object
readonly
Returns the value of attribute blueprint.
Instance Method Summary collapse
- #build_it ⇒ Object
- #define_blueprint(type) ⇒ Object
-
#initialize(type = nil) ⇒ ShipBuilder
constructor
A new instance of ShipBuilder.
Constructor Details
#initialize(type = nil) ⇒ ShipBuilder
Returns a new instance of ShipBuilder.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/uss-enterprise/ship_builders.rb', line 8 def initialize(type = nil) case type when nil @available_blueprints = Blueprints.new.gimme when 'SeaShip' @available_blueprints = SeaShipBlueprints.new.gimme when 'OrbitalShip' @available_blueprints = OrbitalShipBlueprints.new.gimme when 'StarShip' @available_blueprints = StarShipBlueprints.new.gimme end end |
Instance Attribute Details
#available_blueprints ⇒ Object (readonly)
Returns the value of attribute available_blueprints.
6 7 8 |
# File 'lib/uss-enterprise/ship_builders.rb', line 6 def available_blueprints @available_blueprints end |
#blueprint ⇒ Object (readonly)
Returns the value of attribute blueprint.
6 7 8 |
# File 'lib/uss-enterprise/ship_builders.rb', line 6 def blueprint @blueprint end |
Instance Method Details
#build_it ⇒ Object
25 26 27 |
# File 'lib/uss-enterprise/ship_builders.rb', line 25 def build_it puts @blueprint end |
#define_blueprint(type) ⇒ Object
21 22 23 |
# File 'lib/uss-enterprise/ship_builders.rb', line 21 def define_blueprint(type) @blueprint = @available_blueprints[type] end |