Class: AwesomeXML::Duration::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/awesome_xml/duration/format.rb,
lib/awesome_xml/duration/format/static_chunk.rb,
lib/awesome_xml/duration/format/dynamic_chunk.rb

Defined Under Namespace

Classes: DynamicChunk, StaticChunk

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(format_string) ⇒ Format

Returns an ‘AwesomeXML::Duration::Format` instance representing a user defined duration format specified by the passed in `format_string`. Splits the format string into chunks that are each one of either `AwesomeXML::Duration::Format::StaticChunk` or `AwesomeXML::Duration::Format::DynamicChunk` and saves them in the attribute `chunks`. The latter class mentioned is used for a section of the format string inside curly brackets. For more information about the syntax of the format string, read the README.



16
17
18
19
20
# File 'lib/awesome_xml/duration/format.rb', line 16

def initialize(format_string)
  @format_string = format_string
  @chunks = []
  compile
end

Instance Attribute Details

#chunksObject (readonly)

Returns the value of attribute chunks.



7
8
9
# File 'lib/awesome_xml/duration/format.rb', line 7

def chunks
  @chunks
end