Skip to content
Struct like APIs
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
declared
examples
lib
test
.gitignore
.travis.yml
Gemfile
MIT-LICENSE
README.md
Rakefile
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.