[ANN] arrayfields-3.6.0

Discussion in 'Ruby' started by ara.t.howard@noaa.gov, Aug 23, 2006.

  1. Guest

    URLS:

    - http://raa.ruby-lang.org/project/arrayfields/
    - http://www.codeforpeople.com/lib/ruby/arrayfields/
    - http://rubyforge.org/projects/arrayfields/

    SYNOPSIS:

    allow keyword access to arrays:

    require 'arrayfields'

    fields = 'name', 'age'
    row = [ 'bob', 30 ]

    row.fields = fields

    row[ 'name' ] #=> 'bob'
    row.indices 'name', 'age' #=> [ 'bob', 30 ]

    assigning to un-named fields appends:

    stack = []
    stack.fields = %w(zero one)
    stack['zero'] = 'zero'
    stack['one'] = 'one'
    stack #=> [ 'zero', 'one' ]

    useful for database work:

    relation = pgconn.query sql
    relation.size #=> 65536

    # yikes! do we really want to re-construct a hash for for each tuple when
    # we already have Arrays?

    fields = %w(ssn name position)
    table.each{|tuple| tuple.fields = fields}

    tuples[34578]['ssn'] #=> 574865032

    LIST OF OVERRIDDEN METHODS:

    - Array#[]
    - Array#[]=
    - Array#at
    - Array#delete_at
    - Array#fill
    - Array#values_at
    - Array#indices
    - Array#indexes
    - Array#slice
    - Array#slice!

    LIST OF NEW Array METHODS:

    - Array#fields=
    - Array#each_with_field

    DOCS/USAGE/SAMPLE:

    - lib/arrayfields.rb
    - test/arrayfields.rb

    AUTHOR:



    HISTORY:

    3.6.0:
    - made string/symbol keys interchangeable

    list = [0, 1, 2]

    list.fields = %w( a b c )

    p list['a'] #=> 0
    p list[:a] #=> 0


    3.5.0:
    - added more hash-like methods
    - update
    - replace
    - invert

    3.4.0:
    - added FieldedArray[] ctor
    - added methods to make Arrays with fields set behave more closely to Hashes
    - each_pair
    - each_key
    - each_value
    - fetch
    - has_key?
    - member?
    - key?
    - has_value?
    - value?
    - keys?
    - store
    - values

    3.3.0:
    - added gemspec file - thnx Assaph Mehr
    - added FieldedArray proxy class which minimizes modifications to class
    Array and allow ArrayFields to work (potientially) other arraylike object.
    thnks Sean O'Dell
    - added ArrayFields#to_hash method - this seems like an obvious one to add!
    - remedied bug where using append feature of assigning with unknow field
    appedended but did not append to acutal fields
    - added samples
    - created rubyforge accnt @ http://rubyforge.org/projects/arrayfields/

    3.2.0:
    - precedence fix in many methods - thnx. nobu
    - test for #slice! were not being run - corrected
    - added test for appeding via "a['new_field'] = 42"

    3.1.0:
    - added FieldSet class to reduce ram - thnx. Kirk Haines for profiliing
    memory and prompting this change

    - interface changed every so slightly so

    a.fields = 'a', 'b', 'c'

    is not allowed. use

    a.fields = %w(a b c)

    or

    a.fields = ['a', 'b', 'c']


    3.0.0:
    - added unit tests

    -a
    --
    to foster inner awareness, introspection, and reasoning is more efficient than
    meditation and prayer.
    - h.h. the 14th dali lama
     
    , Aug 23, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ara.T.Howard

    [ANN] arrayfields-3.0.0

    Ara.T.Howard, Jun 29, 2004, in forum: Ruby
    Replies:
    14
    Views:
    213
    Sean O'Dell
    Jun 30, 2004
  2. Ara.T.Howard
    Replies:
    2
    Views:
    148
    Ara.T.Howard
    Jun 30, 2004
  3. Ara.T.Howard

    [ANN] arrayfields-3.3.0

    Ara.T.Howard, Jul 1, 2004, in forum: Ruby
    Replies:
    3
    Views:
    119
    Ara.T.Howard
    Jul 1, 2004
  4. Ara.T.Howard

    [ANN] arrayfields-3.4.0

    Ara.T.Howard, Sep 4, 2004, in forum: Ruby
    Replies:
    3
    Views:
    104
    Joao Pedrosa
    Sep 6, 2004
  5. Replies:
    0
    Views:
    82
Loading...

Share This Page