Class: Yell::Formatter::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/yell/formatter.rb

Overview

Builder class to allow setters that won’t be accessible once transferred to the Formatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern = nil, date_pattern = nil, &block) ⇒ Builder

Returns a new instance of Builder.



137
138
139
140
141
142
143
144
# File 'lib/yell/formatter.rb', line 137

def initialize( pattern = nil, date_pattern = nil, &block )
  @modifier = Modifier.new

  @pattern = pattern || Yell::DefaultFormat
  @date_pattern = date_pattern || :iso8601

  block.call(self) if block
end

Instance Attribute Details

#date_patternObject

Returns the value of attribute date_pattern.



134
135
136
# File 'lib/yell/formatter.rb', line 134

def date_pattern
  @date_pattern
end

#modifierObject (readonly)

Returns the value of attribute modifier.



135
136
137
# File 'lib/yell/formatter.rb', line 135

def modifier
  @modifier
end

#patternObject

Returns the value of attribute pattern.



134
135
136
# File 'lib/yell/formatter.rb', line 134

def pattern
  @pattern
end

Instance Method Details

#modify(key, &block) ⇒ Object



146
147
148
# File 'lib/yell/formatter.rb', line 146

def modify( key, &block )
  modifier.set(key, &block)
end