Class: BlockKit::Composition::Text
- Inherits:
-
Base
- Object
- Base
- BlockKit::Composition::Text
show all
- Defined in:
- lib/block_kit/composition/text.rb
Constant Summary
collapse
- MAX_LENGTH =
3000
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#==, fix, #fix_validation_errors, #fix_validation_errors!, fixes, #initialize, inspect, #inspect, #pretty_print, #to_json
Constructor Details
This class inherits a constructor from BlockKit::Base
Class Method Details
.inherited(subclass) ⇒ Object
14
15
16
|
# File 'lib/block_kit/composition/text.rb', line 14
def self.inherited(subclass)
subclass.attribute_fixers = attribute_fixers.deep_dup
end
|
Instance Method Details
#as_json ⇒ Object
28
29
30
|
# File 'lib/block_kit/composition/text.rb', line 28
def as_json(*)
super.merge(text: text)
end
|
#length ⇒ Object
18
19
20
|
# File 'lib/block_kit/composition/text.rb', line 18
def length
text&.length || 0
end
|
#truncate ⇒ Object
22
23
24
25
26
|
# File 'lib/block_kit/composition/text.rb', line 22
def truncate(*)
dup.tap do |copy|
copy.text = text.truncate(*)
end
end
|