<commit_before># What is Likeable?

Likeable is a tiny gem that allows you to add simple 'like' button functionality to existing models.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'likeable'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install likeable

## Usage

To make a model likeable, simply include the Likeable module.

```ruby
class Article
  include Likeable::Target
end
```

...and to enable a user to have the ability to like.

```ruby
class User
  include Likeable::User
end
```

### Methods

There are a few handy methods available to you.

```ruby
article = Article.first

# Like an object
current_user.like! article
# Check whether user has already liked object
current_user.like? article<commit_msg>Updated the readme so that it uses extend instead of include.<commit_after># What is Likeable?

Likeable is a tiny gem that allows you to add simple 'like' button functionality to existing models.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'likeable'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install likeable

## Usage

To make a model likeable, simply extend/include the Likeable module.

```ruby
class Article
  extend Likeable::Target
end
```

...and to enable a user to have the ability to like.

```ruby
class User
  extend Likeable::User
end
```

### Methods

There are a few handy methods available to you.

```ruby
article = Article.first

# Like an object
current_user.like! article
# Check whether user has already liked object
current_user.like? article
{'fraction_non_alphanumeric': 0.07945375543140906, 'fraction_numerical': 0.0, 'mean_word_length': 4.021806853582555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2417153', 'n_tokens_mistral': 484, 'n_tokens_neox': 451, 'n_words': 219}