Class: Thinreports::BasicReport::Core::Shape::TextBlock::Internal
- Inherits:
-
Basic::BlockInternal
- Object
- Basic::Internal
- Basic::BlockInternal
- Thinreports::BasicReport::Core::Shape::TextBlock::Internal
- Defined in:
- lib/thinreports/basic_report/core/shape/text_block/internal.rb
Instance Attribute Summary collapse
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Instance Method Summary collapse
- #format_enabled(enabled) ⇒ Object
- #format_enabled? ⇒ Boolean
-
#initialize(*args) ⇒ Internal
constructor
A new instance of Internal.
- #read_value ⇒ Object
- #real_value ⇒ Object
- #type_of?(type_name) ⇒ Boolean
- #write_value(val) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Internal
Returns a new instance of Internal.
13 14 15 16 17 18 19 20 21 |
# File 'lib/thinreports/basic_report/core/shape/text_block/internal.rb', line 13 def initialize(*args) super(*args) @reference = nil @formatter = nil @style = Style::Text.new(format) @style.accessible_styles.delete(:valign) unless multiple? end |
Instance Attribute Details
#style ⇒ Object (readonly)
Returns the value of attribute style.
11 12 13 |
# File 'lib/thinreports/basic_report/core/shape/text_block/internal.rb', line 11 def style @style end |
Instance Method Details
#format_enabled(enabled) ⇒ Object
49 50 51 |
# File 'lib/thinreports/basic_report/core/shape/text_block/internal.rb', line 49 def format_enabled(enabled) states[:format_enabled] = enabled end |
#format_enabled? ⇒ Boolean
53 54 55 56 57 58 59 |
# File 'lib/thinreports/basic_report/core/shape/text_block/internal.rb', line 53 def format_enabled? if states.key?(:format_enabled) states[:format_enabled] else !blank_value?(format.format_base) || format.has_format? end end |
#read_value ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/thinreports/basic_report/core/shape/text_block/internal.rb', line 23 def read_value if format.has_reference? @reference ||= parent.item(format.ref_id) @reference.value else super end end |
#real_value ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/thinreports/basic_report/core/shape/text_block/internal.rb', line 41 def real_value if format_enabled? formatter.apply(read_value) else super end end |
#type_of?(type_name) ⇒ Boolean
61 62 63 |
# File 'lib/thinreports/basic_report/core/shape/text_block/internal.rb', line 61 def type_of?(type_name) type_name == TextBlock::TYPE_NAME || super end |
#write_value(val) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/thinreports/basic_report/core/shape/text_block/internal.rb', line 32 def write_value(val) if format.has_reference? warn 'The set value was not saved, ' \ "Because '#{format.id}' has reference to '#{format.ref_id}'." else super end end |