Module: Ree::Contracts::Truncatable
- Included in:
- ArgContracts::ArrayOf, ArgContracts::Bool, ArgContracts::Eq, ArgContracts::Exactly, ArgContracts::HashOf, ArgContracts::Ksplat, ArgContracts::Or, ArgContracts::RangeOf, ArgContracts::SetOf, ArgContracts::Splat, ArgContracts::SplatOf, ArgContracts::SubclassOf, BaseValidator
- Defined in:
- lib/ree/contracts/truncatable.rb
Instance Method Summary collapse
Instance Method Details
#truncate(str, limit = 80) ⇒ Object
5 6 7 |
# File 'lib/ree/contracts/truncatable.rb', line 5 def truncate(str, limit = 80) str.length > limit ? "#{str[0..limit]}..." : str end |