<commit_before># Honor
[![Build Status](https://travis-ci.org/jrmyward/honor.png?branch=master)](https://travis-ci.org/jrmyward/honor)

Honor adds support for common gamification features such as points, leaderboards, and achievements.

## Overview

Honor allows you to easily integrate points, rankings, and leaderboards into your Rails application.

## Installation

To use Honor, first add it to you Gemfile:

```ruby
 gem 'honor'
```

And then intall it with bundler by executing:

```shell
bundle install
```

Install and run the migrations:

```shell
rails g honor:install
rails db:migrate
```

## Usage

Honor is meant to be used with a **single model** (eg. User, Employee, Person, Company, etc). At this time, using Honor with multiple models is NOT supported.

```ruby
class User < ActiveRecord::Base
  include Honor
end
```

Honor adds two new relationships to the receiving model.

1. `has_many :points`
2. `has_one :scorecard`

### Points

Points are generally awarded for various User interactions throughout an application. Honor gives you the ability to provide a message as well as a classification to each point block awarded.

```ruby
class User < ActiveRecord::Base
  include Honor
end

@user = User.new

# add points to a user
@user.add_points(25)
<commit_msg>Fixed typo in README<commit_after># Honor
[![Build Status](https://travis-ci.org/jrmyward/honor.png?branch=master)](https://travis-ci.org/jrmyward/honor)

Honor adds support for common gamification features such as points, leaderboards, and achievements.

## Overview

Honor allows you to easily integrate points, rankings, and leaderboards into your Rails application.

## Installation

To use Honor, first add it to you Gemfile:

```ruby
 gem 'honor'
```

And then intall it with bundler by executing:

```shell
bundle install
```

Install and run the migrations:

```shell
rails g honor:install
rake db:migrate
```

## Usage

Honor is meant to be used with a **single model** (eg. User, Employee, Person, Company, etc). At this time, using Honor with multiple models is NOT supported.

```ruby
class User < ActiveRecord::Base
  include Honor
end
```

Honor adds two new relationships to the receiving model.

1. `has_many :points`
2. `has_one :scorecard`

### Points

Points are generally awarded for various User interactions throughout an application. Honor gives you the ability to provide a message as well as a classification to each point block awarded.

```ruby
class User < ActiveRecord::Base
  include Honor
end

@user = User.new

# add points to a user
@user.add_points(25)

{'fraction_non_alphanumeric': 0.0926791277258567, 'fraction_numerical': 0.003115264797507788, 'mean_word_length': 4.658590308370044, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '2290387', 'n_tokens_mistral': 785, 'n_tokens_neox': 741, 'n_words': 329}