Class Limelight::Recruiter
In: lib/limelight/casting_director.rb
Parent: Object

Methods

Public Class methods

[Source]

    # File lib/limelight/casting_director.rb, line 49
49:     def initialize(prop, player_name, loader)
50:       @prop = prop
51:       @cast = prop.scene.cast
52:       @player_name = player_name
53:       @module_name = player_name.camalized
54:       @loader = loader
55:     end

Public Instance methods

[Source]

    # File lib/limelight/casting_director.rb, line 57
57:     def player
58:       return @cast.const_get(@module_name)
59:     end

[Source]

    # File lib/limelight/casting_director.rb, line 61
61:     def player_already_exists?
62:       return @cast.const_defined?(@module_name)
63:     end

[Source]

    # File lib/limelight/casting_director.rb, line 65
65:     def player_exists?
66:       recruit_player if !player_already_exists?
67:       return @cast.const_get(@module_name) != :does_not_exist
68:     end

[Source]

    # File lib/limelight/casting_director.rb, line 81
81:     def recruit_builtin_player
82:       begin
83:         return if !Limelight::Builtin::Players.const_defined?(@module_name)
84:         @cast.const_set(@module_name, Limelight::Builtin::Players.const_get(@module_name))
85:       rescue NameError
86:       end
87:     end

[Source]

    # File lib/limelight/casting_director.rb, line 76
76:     def recruit_custom_player
77:       player_filename = locate_player
78:       load_player(player_filename) if player_filename
79:     end

[Source]

    # File lib/limelight/casting_director.rb, line 70
70:     def recruit_player
71:       recruit_custom_player
72:       recruit_builtin_player if !player_already_exists?
73:       @cast.const_set(@module_name, :does_not_exist) if !player_already_exists?
74:     end

[Validate]