Class: Runner
- Inherits:
-
Object
- Object
- Runner
- Defined in:
- lib/runner.rb
Instance Method Summary collapse
-
#camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) ⇒ Object
from active support.
-
#initialize(venue) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(venue) ⇒ Runner
Returns a new instance of Runner.
7 8 9 10 11 12 13 14 15 |
# File 'lib/runner.rb', line 7 def initialize(venue) require venue klass = camelize(venue) puts klass parser = Object.const_get(klass).new puts parser.about.inspect res = parser.parse puts res end |
Instance Method Details
#camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) ⇒ Object
from active support
18 19 20 21 22 23 24 |
# File 'lib/runner.rb', line 18 def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true) if first_letter_in_uppercase lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } else lower_case_and_underscored_word.to_s[0].chr.downcase + camelize(lower_case_and_underscored_word)[1..-1] end end |