Class: Agree2::Agreement
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#active? ⇒ Boolean
has agreement been signed by all parties?.
-
#finalize! ⇒ Object
Finalize marks a draft agreement as being ready to accept.
-
#parties ⇒ Object
Returns the parties to the agreement.
- #parties=(values) ⇒ Object
-
#respond_to?(symbol, include_priv = false) ⇒ Boolean
:nodoc:.
-
#state ⇒ Object
state of the agreement draft, final, active, terminated.
-
#to_param ⇒ Object
:nodoc:.
Methods inherited from Base
attr_read_only, attr_serializable, #attributes, collection_name, collection_path, #destroy, get, #initialize, instance_path, #new_record?, #path, read_only_attributes, #reload, #save, serializable_attributes, singular_name, #to_url
Constructor Details
This class inherits a constructor from Agree2::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (protected)
:nodoc:
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/agree2/agreement.rb', line 63 def method_missing(method, *args, &block) #:nodoc: return super(method, *args, &block) if fields.nil?||fields.empty? method=method.to_s if method=~/(.+)=$/ field=$1 setter=true else field=method setter=false end if fields.has_key?(field) if setter fields[field]=args.first else fields[field] end else super method, *args, &block end end |
Instance Method Details
#active? ⇒ Boolean
has agreement been signed by all parties?
30 31 32 |
# File 'lib/agree2/agreement.rb', line 30 def active? state=='active' end |
#finalize! ⇒ Object
Finalize marks a draft agreement as being ready to accept
49 50 51 |
# File 'lib/agree2/agreement.rb', line 49 def finalize! user.post(path+"/finalize")==" " end |
#parties ⇒ Object
Returns the parties to the agreement
11 12 13 |
# File 'lib/agree2/agreement.rb', line 11 def parties @parties||=Agree2::ProxyCollection.new self,"#{self.path}/parties",'Party' end |
#parties=(values) ⇒ Object
15 16 17 |
# File 'lib/agree2/agreement.rb', line 15 def parties=(values) @parties=Agree2::ProxyCollection.new self,"#{self.path}/parties",'Party',values end |
#respond_to?(symbol, include_priv = false) ⇒ Boolean
:nodoc:
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/agree2/agreement.rb', line 34 def respond_to?(symbol, include_priv = false) #:nodoc: return true if super symbol,include_priv return false if fields.nil?||fields.empty? method=symbol.to_s if method=~/(.+)=$/ field=$1 setter=true else field=method setter=false end fields.has_key?(field) end |
#state ⇒ Object
state of the agreement draft, final, active, terminated
25 26 27 |
# File 'lib/agree2/agreement.rb', line 25 def state @state||=load_state end |
#to_param ⇒ Object
:nodoc:
19 20 21 |
# File 'lib/agree2/agreement.rb', line 19 def to_param #:nodoc: permalink end |