Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Struct like APIs

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 declared
Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 structable.gemspec
README.md

structable

Build Status Gem Version

"Struct" like APIs

Features

  • Be appendable "Struct" like APIs
  • Member aliasing
  • Inheritable

Usage

Setup

require 'structable'

Overview

class Drink
  include Structable

  member :taste
end

class Tea < Drink
  member :leaf
  alias_member :type, :leaf
end

tea = Tea.new :bitter, :green
tea.members                    #=> [:taste, :leaf]
tea.members(true)              #=> [:taste, :leaf, :type]
tea.member? :type              #=> true
tea.type = 'Special Flavor'
tea.taste                      #=> :bitter
tea.leaf                       #=> 'Special Flavor'

Requirements

Installation

$ gem install structable

Links

License

The MIT X11 License
Copyright (C) 2011-2012 Kenichi Kamiya
See MIT-LICENSE for further details.

Something went wrong with that request. Please try again.