Class: Thinreports::BasicReport::Core::Shape::TextBlock::Formatter::Basic
- Inherits:
-
Object
- Object
- Thinreports::BasicReport::Core::Shape::TextBlock::Formatter::Basic
- Includes:
- Utils
- Defined in:
- lib/thinreports/basic_report/core/shape/text_block/formatter/basic.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
Instance Method Summary collapse
- #apply(value) ⇒ Object
-
#initialize(format) ⇒ Basic
constructor
A new instance of Basic.
Methods included from Utils
#blank_value?, #call_block_in, #deep_copy, included
Constructor Details
#initialize(format) ⇒ Basic
Returns a new instance of Basic.
14 15 16 |
# File 'lib/thinreports/basic_report/core/shape/text_block/formatter/basic.rb', line 14 def initialize(format) @format = format end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
12 13 14 |
# File 'lib/thinreports/basic_report/core/shape/text_block/formatter/basic.rb', line 12 def format @format end |
Instance Method Details
#apply(value) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/thinreports/basic_report/core/shape/text_block/formatter/basic.rb', line 18 def apply(value) value = apply_format_to(value) if applicable?(value) return value if blank_value?(format.format_base) format.format_base.gsub(/\{value\}/, value.to_s) end |