module Crayon::MethodParser
Public Instance Methods
parse_background()
click to toggle source
# File lib/crayon/method_parser.rb, line 10 def parse_background on_index = @method_name_components.index("on") return nil unless on_index background = @method_name_components.delete_at(on_index + 1) background if COLORS.include?(background) end
parse_foreground()
click to toggle source
# File lib/crayon/method_parser.rb, line 17 def parse_foreground @method_name_components.find {|color| COLORS.include?(color) } end
parse_formatting()
click to toggle source
# File lib/crayon/method_parser.rb, line 21 def parse_formatting @method_name_components.select {|format| FORMATS.include?(format) } end
parse_method_name()
click to toggle source
# File lib/crayon/method_parser.rb, line 3 def parse_method_name @method_name_components = @method_name.to_s.downcase.split("_") @background = parse_background @foreground = parse_foreground @formatting = parse_formatting end