Class: ModelFormatting::FormattedPart
- Defined in:
- lib/model_formatting.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes inherited from Part
Instance Method Summary collapse
- #formatted_string ⇒ Object
-
#initialize(format, options = {}, *args) ⇒ FormattedPart
constructor
A new instance of FormattedPart.
Methods inherited from Part
#<<, #==, #compact!, #inspect, #simple_string
Constructor Details
#initialize(format, options = {}, *args) ⇒ FormattedPart
Returns a new instance of FormattedPart.
62 63 64 65 |
# File 'lib/model_formatting.rb', line 62 def initialize(format, = {}, *args) @options = || {} super(format, *args) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
60 61 62 |
# File 'lib/model_formatting.rb', line 60 def @options end |
Instance Method Details
#formatted_string ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/model_formatting.rb', line 67 def formatted_string @formatted_string ||= begin str = simple_string str = @options[:before].call(@format, str, @options) if @options[:before] str end end |