Class: DataMapper::Property::String
- Inherits:
-
Object
- Object
- DataMapper::Property
- Object
- DataMapper::Property::String
- Defined in:
- lib/dm-core/property/string.rb
Constant Summary
- DEFAULT_LENGTH =
50
Constants inherited from DataMapper::Property
INVALID_NAMES, OPTIONS, PRIMITIVES, VISIBILITY_OPTIONS
Instance Attribute Summary
Attributes inherited from DataMapper::Property
#allow_blank, #allow_nil, #coercion_method, #default, #dump_as, #index, #instance_variable_name, #load_as, #model, #name, #options, #reader_visibility, #repository_name, #required, #unique_index, #writer_visibility
Instance Method Summary (collapse)
-
- (String) initialize(model, name, options = {})
constructor
protected
A new instance of String.
-
- (Integer?) length
Returns maximum property length (if applicable).
Methods inherited from Object
#dump, #load, #marshal, #to_child_key, #unmarshal
Methods inherited from DataMapper::Property
accept_options, accepted_options, #allow_blank?, #allow_nil?, #assert_valid_options, #assert_valid_value, #bind, demodulized_names, descendants, determine_class, #determine_visibility, #field, find_class, #get, #get!, inherited, #inspect, #key?, #lazy?, #lazy_load, #lazy_load_properties, #loaded?, nullable, options, primitive, #primitive, #primitive?, #properties, #required?, #serial?, #set, #set!, #typecast, #unique?, #valid?, #value_dumped?, #value_loaded?
Methods included from Deprecate
Methods included from Equalizer
Methods included from Subject
Methods included from Assertions
Constructor Details
- (String) initialize(model, name, options = {}) (protected)
A new instance of String
31 32 33 34 |
# File 'lib/dm-core/property/string.rb', line 31 def initialize(model, name, = {}) super @length = @options.fetch(:length) end |
Instance Method Details
- (Integer?) length
Returns maximum property length (if applicable). This usually only makes sense when property is of type Range or custom
21 22 23 24 25 26 27 |
# File 'lib/dm-core/property/string.rb', line 21 def length if @length.kind_of?(Range) @length.max else @length end end |