Class/Module Index [+]

Quicksearch

Gyoku::XMLKey

Public Class Methods

create(key, options = {}) click to toggle source

Converts a given object with options to an XML key.

# File lib/gyoku/xml_key.rb, line 15
def create(key, options = {})
  xml_key = chop_special_characters key.to_s

  if unqualified = unqualify?(xml_key)
    xml_key = xml_key.split(":").last
  end

  xml_key = symbol_converter.call(xml_key) if Symbol === key

  if !unqualified && qualify?(options) && !xml_key.include?(":")
    xml_key = "#{options[:namespace]}:#{xml_key}"
  end

  xml_key
end
symbol_converter() click to toggle source

Returns the formula for converting Symbol keys.

# File lib/gyoku/xml_key.rb, line 32
def symbol_converter
  @symbol_converter ||= FORMULAS[:lower_camelcase]
end
symbol_converter=(formula) click to toggle source

Sets the formula for converting Symbol keys. Accepts one of FORMULAS of an object responding to :call.

# File lib/gyoku/xml_key.rb, line 38
def symbol_converter=(formula)
  formula = FORMULAS[formula] unless formula.respond_to? :call
  raise ArgumentError, "Invalid symbol_converter formula" unless formula

  @symbol_converter = formula
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.