Module: DMap::Properties

Defined in:
lib/dmap/properties.rb,
lib/dmap/properties/core.rb,
lib/dmap/properties/date.rb,
lib/dmap/properties/misc.rb,
lib/dmap/properties/serial.rb,
lib/dmap/properties/string.rb,
lib/dmap/properties/boolean.rb,
lib/dmap/properties/integer.rb

Defined Under Namespace

Classes: B, Binary, Blob, Bool, Boolean, D, Date, DateTime, Datetime, Disc, Discriminator, Dt, I, Int, Integer, Obj, Object, Primary, S, Serial, Str, String, T, Text, Time, Txt

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#listObject

Returns the value of attribute list.



3
4
5
# File 'lib/dmap/properties.rb', line 3

def list
  @list
end

Class Method Details

.add(table, property = nil, value = nil, bucket = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dmap/properties.rb', line 23

def add(table, property=nil, value=nil, bucket=nil)
  list[table] = {} if list[table].nil?
  unless property.nil?
    list[table][property] = {} if list[table][property].nil?
    if bucket.nil?
      list[table].store property, value unless value.nil?
    else
      list[table][property][bucket] = value
    end
  end
end

.listObject



19
20
21
# File 'lib/dmap/properties.rb', line 19

def list
  @list ||= Hash[]
end

.required(value) ⇒ Object

default methods



6
7
8
# File 'lib/dmap/properties/core.rb', line 6

def required(value)
  value.is_a?(Boolean)
end

.valid?(klass) ⇒ Boolean

Returns:



10
11
12
13
14
15
16
17
# File 'lib/dmap/properties.rb', line 10

def valid?(klass)
  begin
    # Don't need if I need to do the sub() thing anymore...
    self.const_get(klass.capitalize.sub('Datetime', 'DateTime')).is_a?(Class)
  rescue
    false
  end
end