Class: Description
- Inherits:
-
Data
- Object
- Data
- Description
- Defined in:
- lib/inat-channel/data_types.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value
145 146 147 |
# File 'lib/inat-channel/data_types.rb', line 145 def value @value end |
Instance Method Details
#html ⇒ Object
152 153 154 155 156 157 158 159 160 |
# File 'lib/inat-channel/data_types.rb', line 152 def html sanitized = Sanitize.fragment value, IC::SANITIZE_HTML_CONFIG if sanitized.length > IC::CONFIG.dig(:tg_bot, :desc_limit) # В отличие от простого текста, обрезка HTML требует куда более изощренной логики, что неоправданно text else sanitized end end |
#icon ⇒ Object
146 147 148 |
# File 'lib/inat-channel/data_types.rb', line 146 def icon IC::ICONS[:description] end |
#text ⇒ Object
149 150 151 |
# File 'lib/inat-channel/data_types.rb', line 149 def text Sanitize.fragment(value, IC::SANITIZE_TEXT_CONFIG).limit(IC::CONFIG.dig(:tg_bot, :desc_limit)) end |