Class: DataMapper::Property::StringArray

Inherits:
PgArray
  • Object
show all
Defined in:
lib/dm-pg-types/string_array.rb

Constant Summary collapse

DEFAULT_LENGTH =
50

Instance Method Summary collapse

Methods inherited from PgArray

#dump, #load

Constructor Details

#initialize(model, name, options = {}) ⇒ StringArray

Returns a new instance of StringArray.



19
20
21
22
# File 'lib/dm-pg-types/string_array.rb', line 19

def initialize(model, name, options = {})
  super
  @length = @options.fetch(:length)
end

Instance Method Details

#lengthObject



11
12
13
14
15
16
17
# File 'lib/dm-pg-types/string_array.rb', line 11

def length
  if @length.kind_of?(Range)
    @length.max
  else
    @length
  end
end