Class: OpenWFE::Extras::Field

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/openwfe/extras/participants/activeparticipants.rb

Overview

A Field (Attribute) of a Workitem.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new_field(key, value) ⇒ Object

A quick method for doing

f = Field.new
f.key = key
f.value = value

One can then quickly add fields to an [active] workitem via :

wi.fields << Field.new_field("toto", "b")

This method does not save the new Field.



413
414
415
416
417
418
419
# File 'lib/openwfe/extras/participants/activeparticipants.rb', line 413

def self.new_field (key, value)

    f = Field.new
    f.fkey = key
    f.value = value
    f
end

Instance Method Details

#valueObject



430
431
432
433
434
# File 'lib/openwfe/extras/participants/activeparticipants.rb', line 430

def value

    return self.svalue if self.svalue
    self.yvalue
end

#value=(v) ⇒ Object



421
422
423
424
425
426
427
428
# File 'lib/openwfe/extras/participants/activeparticipants.rb', line 421

def value= (v)

    if v.is_a?(String)
        self.svalue = v 
    else
        self.yvalue = v
    end
end