Nori

Constants

VERSION

Attributes

advanced_typecasting[W]

Sets whether to use advanced typecasting.

strip_namespaces[W]

Sets whether to strip namespaces.

Public Instance Methods

advanced_typecasting?() click to toggle source

Returns whether to use advanced typecasting. Defaults to true.

# File lib/nori.rb, line 30
def advanced_typecasting?
  @advanced_typecasting != false
end
configure() click to toggle source

Yields self for configuration.

# File lib/nori.rb, line 21
def configure
  yield self
end
convert_tag(tag) click to toggle source

Transforms a given tag using the specified conversion formula.

# File lib/nori.rb, line 50
def convert_tag(tag)
  @convert_tag.call(tag)
end
convert_tags?() click to toggle source

Returns whether to convert tags.

# File lib/nori.rb, line 55
def convert_tags?
  @convert_tag
end
convert_tags_to(reset = nil, &block) click to toggle source

Expects a block which receives a tag to convert. Accepts nil for a reset to the default behavior of not converting tags.

# File lib/nori.rb, line 45
def convert_tags_to(reset = nil, &block)
  @convert_tag = reset || block
end
parse(xml, parser = nil) click to toggle source

Translates the given xml to a Hash. Accepts an optional parser to use.

# File lib/nori.rb, line 10
def parse(xml, parser = nil)
  return {} if xml.blank?
  Parser.parse xml, parser
end
parser=(parser) click to toggle source

Sets the parser to use.

# File lib/nori.rb, line 16
def parser=(parser)
  Parser.use = parser
end
strip_namespaces?() click to toggle source

Returns whether to strip namespaces. Defaults to false.

# File lib/nori.rb, line 39
def strip_namespaces?
  @strip_namespaces
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.