module Volt::AttributeScope::ClassMethods

Public Instance Methods

methodize_string(str) click to toggle source
# File lib/volt/server/html_parser/attribute_scope.rb, line 5
def methodize_string(str)
  # Convert the string passed in to the binding so it returns a ruby Method
  # instance
  parts = str.split('.')

  end_call = parts.last.strip

  # If no method(args) is passed, we assume they want to convert the method
  # to a Method, to be called with *args (from any trigger's), then event.
  if str !~ /[\[\]\$\@\=]/ && end_call =~ /[_a-z0-9!?]+$/
    parts[-1] = "method(:#{end_call})"

    str = parts.join('.')
  end

  str
end