Sha256: afbc038940d6b93a6d39593f61605d0df12a35dd1d9534f94ff10a14698b6d56

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

# Render::Text::Helper

This gem extends text manipulation to classes like String, Boolean etc..

## Installation

Install the gem and add to the application's Gemfile by executing:

    $ bundle add render-text-helper

If bundler is not being used to manage dependencies, install the gem by executing:

    $ gem install render-text-helper

## Usage

### Limit Print

This function makes sure that the string does not go over a specific given limit.
It has two parameters "limit" which is defaulted to 32 and "more_indicator" which
defaults to "."

```ruby
'hello'.limit_print
'hello'

'elephant'.limit_print(limit: 2)
'el...'

'elephant'.limit_print(limit: 2, more_indicator: '')
'el'

'elephant'.limit_print(limit: 3, more_indicator: '_')
'ele___'
```

### to yes no

This function returns a string from a boolean to yes or no.

```ruby
true.to_yes_no
'yes'

true.to_yes_no(capital_letter: true)
'YES'

false.to_yes_no
'no'

false.to_yes_no(capital_letter: true)
'NO'
```

### to yn

This function returns a string from a boolean to Y or N

```ruby
true.to_yn
'Y'

true.to_yn(capital_letter: false)
'y'

false.to_yn
'N'

false.to_yn(capital_letter: false)
'n'
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/SaimonL/render-text-helper

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
render-text-helper-0.1.0 README.md