Module: Peachy

Defined in:
lib/peachy.rb,
lib/peachy/mimic.rb,
lib/peachy/proxy.rb,
lib/peachy/version.rb,
lib/peachy/xml_node.rb,
lib/peachy/method_mask.rb,
lib/peachy/method_name.rb,
lib/peachy/compatibility.rb,
lib/peachy/my_meta_class.rb,
lib/peachy/string_styler.rb,
lib/peachy/simple_content.rb,
lib/peachy/morph_into_array.rb,
lib/peachy/current_method_call.rb,
lib/peachy/parsers/rexml_wrapper.rb,
lib/peachy/parsers/parser_factory.rb,
lib/peachy/parsers/parser_wrapper.rb,
lib/peachy/parsers/nokogiri_wrapper.rb,
lib/peachy/childless_proxy_with_attributes.rb,
lib/peachy/parsers/rexml_attribute_wrapper.rb

Defined Under Namespace

Modules: ChildlessProxyWithAttributes, Compatibility, MethodMask, Mimic, MorphIntoArray, MyMetaClass, Parsers, StringStyler, XmlNode Classes: CurrentMethodCall, MethodName, Proxy, SimpleContent

Constant Summary collapse

VERSION =
'0.4.1'

Class Method Summary collapse

Class Method Details

.be_loudObject

Tells Peachy to be loud about XML nodes that don’t exist, by raising a NoMatchingXmlPart error. Use this setting when you want to know about any XML nodes that unexpectedly don’t exist. This is the default setting, rather than #be_quiet.



38
39
40
# File 'lib/peachy.rb', line 38

def self.be_loud
  @quiet = false
end

.be_quietObject

Tells Peachy to quietly return nil when an xml node is not found, rather than throwing a NoMatchingXmlPart error. Use this setting when you want to have a conditional piece of logic with an XML node that may or may not exist.



30
31
32
# File 'lib/peachy.rb', line 30

def self.be_quiet
  @quiet = true
end

.being_quiet?Boolean

Indicates whether Peachy is being quiet, i.e. whether Peachy will return nil when an XML node is not found by a Peachy::Proxy

Returns:

  • (Boolean)


44
45
46
# File 'lib/peachy.rb', line 44

def self.being_quiet?
  return @quiet
end

.proxy(xml) ⇒ Object

Creates a new proxy from the XML string passed to it.



60
61
62
63
# File 'lib/peachy.rb', line 60

def self.proxy xml
  create_factory unless defined? @factory
  return Proxy.new(@factory.make_from(xml))
end

.whineObject

Tells Peachy that it should be whiny, and print all of the steps that it knows to report to screen.



50
51
52
# File 'lib/peachy.rb', line 50

def self.whine
  @whine = true
end

.whiny?Boolean

Indicates whether Peachy will #whine when it runs or not.

Returns:

  • (Boolean)


55
56
57
# File 'lib/peachy.rb', line 55

def self.whiny?
  return @whine
end