Class: SdbDal::LazyLoadingText

Inherits:
Object
  • Object
show all
Defined in:
lib/sdb_dal/lazy_loading_text.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(get_clob_proc) ⇒ LazyLoadingText

Returns a new instance of LazyLoadingText.



9
10
11
12
13
# File 'lib/sdb_dal/lazy_loading_text.rb', line 9

def initialize(get_clob_proc)
  @get_clob_proc=get_clob_proc
  @has_loaded=false
  @is_dirty=false
end

Instance Attribute Details

#has_loadedObject (readonly)

Returns the value of attribute has_loaded.



8
9
10
# File 'lib/sdb_dal/lazy_loading_text.rb', line 8

def has_loaded
  @has_loaded
end

#is_dirtyObject (readonly)

Returns the value of attribute is_dirty.



7
8
9
# File 'lib/sdb_dal/lazy_loading_text.rb', line 7

def is_dirty
  @is_dirty
end

Instance Method Details

#valueObject



20
21
22
23
24
25
26
27
# File 'lib/sdb_dal/lazy_loading_text.rb', line 20

def value
  if !@did_load
      @value= @get_clob_proc.call      
      @has_loaded=true          
  end
  return @value
  
end

#value=(v) ⇒ Object



15
16
17
18
19
# File 'lib/sdb_dal/lazy_loading_text.rb', line 15

def value=(v)
  @is_dirty=true
  @has_loaded=true
  @value=v
end