class Rubygoal::CoachLoader
Constants
- DEFAULT_COACH_DEFINITIONS
Attributes
side[R]
Public Class Methods
new(side)
click to toggle source
# File lib/rubygoal/coach_loader.rb, line 12 def initialize(side) @side = side end
Public Instance Methods
coach()
click to toggle source
# File lib/rubygoal/coach_loader.rb, line 16 def coach Coach.new(load_definition_coach) end
Private Instance Methods
camelize(term)
click to toggle source
# File lib/rubygoal/coach_loader.rb, line 47 def camelize(term) string = term.to_s string = string.sub(/^[a-z\d]*/) { $&.capitalize } string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" } string.gsub!('/', '::') string end
default_definition_class()
click to toggle source
# File lib/rubygoal/coach_loader.rb, line 24 def default_definition_class DEFAULT_COACH_DEFINITIONS[side] end
filename()
click to toggle source
# File lib/rubygoal/coach_loader.rb, line 43 def filename side == :home ? ARGV[0] : ARGV[1] end
load_definition_coach()
click to toggle source
# File lib/rubygoal/coach_loader.rb, line 28 def load_definition_coach if filename && File.exists?(filename) load filename class_name = camelize(File.basename(filename, ".rb")) Rubygoal.const_get(class_name).new else if filename && Rubygoal.configuration.debug_output puts "File `#{filename}` doesn't exist. Using #{default_definition_class.name}." end default_definition_class.new end end