Module: Arrayr
- Defined in:
- lib/arrayr.rb
Defined Under Namespace
Modules: ClassMethods Classes: Value
Class Method Summary collapse
-
.included(klass) ⇒ Object
Module to use for letting attributes automatically return arrays for comma separated values.
Class Method Details
.included(klass) ⇒ Object
Module to use for letting attributes automatically return arrays for comma separated values
Specify which attributes that should return array as values and access the value by suffixing the attribute with “_multiple”
If a getter and setter doens’t exists this module will create them for you.
Example
class Foo
include Array
attr_array(:bar)
end
foo = Foo.new foo.bar = “zoo, zum” foo.bar_to_a => [“zoo”, “zum”]
23 24 25 |
# File 'lib/arrayr.rb', line 23 def self.included(klass) klass.extend ClassMethods end |