Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 2.38 KB

README.rdoc

File metadata and controls

52 lines (37 loc) · 2.38 KB

labelized

A simple Ruby library for labeling things. Similar to and inspired by acts_as_taggable_on but more flexible. Labelized allows you to control every aspect of label items, including the label to labeled relation. Labels can be organized into label sets. Labelized takes the approach of mixing in functionality with configuration, so you include just what you need. While labelized depends on ActiveRecord, it doesn’t provide you with any models. You mixin labeleized concerns to your own models and have complete control over everything including the labels and how they get linked to your models.

Usage

Passing a term in the singular allows only a single label. Plural terms allow multiple labels. The optional scope allows for multiple instances of the same tag, isolated by the scope; i.e. different capitalizations. Labelized doesn’t assume much about your model space. You mix in the appropriate labelized module and configure a few options.

A Simple Example

# Call labelized on a class you want to act as the label
class Label < ActiveRecord::Base
  include Labelized::LabelConcern

  labelized
end

# Include the LabelizedConcern and call labelized on a class you want to  label
class Thing < ActiveRecord::Base
  include Labelized::LabelizedConcern

  labelized :labels
end

thing = Thing.new
thing.labels # []
thing.label 'label one'
thing.labels_for 'round', :shape #

thing.kind # 'this'
thing.kind_list # 'this'

thing.keywords
thing.keywords = ['this', 'that']
thing.keywords = 'this, that'
thing.keywords # 'this, that'
thing.keyword_list # ['this', 'that']

thing.tracks

Contributing to labelized

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Peter T. Brown. See LICENSE.txt for further details.