Class: Stratagem::Model::Component::Reference
- Defined in:
- lib/stratagem/model/components/reference.rb
Constant Summary collapse
- EQUALITY_ATTRS =
[:reference_type, :from_component, :to_component, :line_number, :method, :function]
Instance Attribute Summary collapse
-
#from_component ⇒ Object
Returns the value of attribute from_component.
-
#function ⇒ Object
Returns the value of attribute function.
-
#line_number ⇒ Object
Returns the value of attribute line_number.
-
#options ⇒ Object
Returns the value of attribute options.
-
#reference_type ⇒ Object
:read, :write.
-
#request_method ⇒ Object
Returns the value of attribute request_method.
-
#stack_trace ⇒ Object
Returns the value of attribute stack_trace.
-
#to_component ⇒ Object
Returns the value of attribute to_component.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #compressed_stack_trace ⇒ Object
- #eql?(other) ⇒ Boolean
- #export ⇒ Object
-
#initialize(args = {}) ⇒ Reference
constructor
A new instance of Reference.
Constructor Details
#initialize(args = {}) ⇒ Reference
Returns a new instance of Reference.
9 10 11 |
# File 'lib/stratagem/model/components/reference.rb', line 9 def initialize(args={}) args.each {|key,val| self.send("#{key}=", val) } end |
Instance Attribute Details
#from_component ⇒ Object
Returns the value of attribute from_component.
4 5 6 |
# File 'lib/stratagem/model/components/reference.rb', line 4 def from_component @from_component end |
#function ⇒ Object
Returns the value of attribute function.
5 6 7 |
# File 'lib/stratagem/model/components/reference.rb', line 5 def function @function end |
#line_number ⇒ Object
Returns the value of attribute line_number.
5 6 7 |
# File 'lib/stratagem/model/components/reference.rb', line 5 def line_number @line_number end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/stratagem/model/components/reference.rb', line 5 def @options end |
#reference_type ⇒ Object
:read, :write
3 4 5 |
# File 'lib/stratagem/model/components/reference.rb', line 3 def reference_type @reference_type end |
#request_method ⇒ Object
Returns the value of attribute request_method.
5 6 7 |
# File 'lib/stratagem/model/components/reference.rb', line 5 def request_method @request_method end |
#stack_trace ⇒ Object
Returns the value of attribute stack_trace.
5 6 7 |
# File 'lib/stratagem/model/components/reference.rb', line 5 def stack_trace @stack_trace end |
#to_component ⇒ Object
Returns the value of attribute to_component.
4 5 6 |
# File 'lib/stratagem/model/components/reference.rb', line 4 def to_component @to_component end |
Instance Method Details
#==(other) ⇒ Object
13 14 15 |
# File 'lib/stratagem/model/components/reference.rb', line 13 def ==(other) eql?(other) end |
#compressed_stack_trace ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/stratagem/model/components/reference.rb', line 37 def compressed_stack_trace if (stack_trace) TraceDeflator.deflate(stack_trace) else nil end end |
#eql?(other) ⇒ Boolean
17 18 19 20 21 |
# File 'lib/stratagem/model/components/reference.rb', line 17 def eql?(other) EQUALITY_ATTRS.find {|attribute| self.send(attribute) != other.send(attribute) }.nil? end |
#export ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/stratagem/model/components/reference.rb', line 23 def export h = { :external_id => self.object_id, :reference_type => reference_type, :from_component_external_id => from_component ? from_component.object_id : nil, :to_component_external_id => to_component ? to_component.object_id : nil, :line_number => line_number, :request_method => request_method, :function => function, :options => ? .to_json : nil, :stack_trace => reference_type == :write ? compressed_stack_trace : nil } end |