Class: Pinpoint::Format::Style
- Inherits:
-
Object
- Object
- Pinpoint::Format::Style
- Defined in:
- lib/pinpoint/format/style.rb
Class Method Summary collapse
-
.from_yaml(style_definition) ⇒ Object
Public: Processes the style information gleaned from the Pinpoint YAML format and generates a Style from it.
Instance Method Summary collapse
-
#output(address) ⇒ Object
Public: Can take an address-like object and output it in the style specified by the structure.
Class Method Details
.from_yaml(style_definition) ⇒ Object
Public: Processes the style information gleaned from the Pinpoint YAML format and generates a Style from it.
style - The style information from the Pinpoint YAML format file. For
example:
(%s, )(%l, )(%p )%z(, %c)
Returns a Pinpoint::Format::Style based on the information passed in.
18 19 20 21 22 |
# File 'lib/pinpoint/format/style.rb', line 18 def self.from_yaml(style_definition) style = new style.send(:structure=, Format::Parser.new(style_definition).parse) style end |
Instance Method Details
#output(address) ⇒ Object
Public: Can take an address-like object and output it in the style specified by the structure.
Example
# Assuming address is an address-like object and Style was
# instantiated with '(%s, )(%l, )(%p )%z(, %c)'
output address
# => '123 First Street, Nashville, TN 37033, United States'
35 36 37 |
# File 'lib/pinpoint/format/style.rb', line 35 def output(address) process(structure, address) end |