Class: ModelColumn

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/clevic/model_column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, hash) ⇒ ModelColumn

Returns a new instance of ModelColumn.



14
15
16
17
18
19
# File 'lib/clevic/model_column.rb', line 14

def initialize( name, hash )
  super(hash)

  # must be after hash so it takes precedence
  @name = name
end

Instance Attribute Details

#limitObject

if it’s not here, it’s probably from Sequel, so figure it out from the db_type



26
27
28
29
30
31
32
# File 'lib/clevic/model_column.rb', line 26

def limit
  unless @limit
    db_type =~ /\((\d+)\)/
    @limit = $1.to_i
  end
  @limit
end

#nameObject (readonly)

Returns the value of attribute name.



21
22
23
# File 'lib/clevic/model_column.rb', line 21

def name
  @name
end

Instance Method Details

#association?Boolean

Returns:

  • (Boolean)


22
# File 'lib/clevic/model_column.rb', line 22

def association?; association; end


36
37
38
# File 'lib/clevic/model_column.rb', line 36

def related_class
  @related_class ||= eval class_name
end