Class: Isomorphic::Node::ProcTo
- Inherits:
-
AbstractNode
- Object
- AbstractNode
- Isomorphic::Node::ProcTo
- Defined in:
- lib/isomorphic/node.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Attributes inherited from AbstractNode
#factory, #inflector, #options, #parent
Instance Method Summary collapse
- #from_isomorphism(scope, instance, record = nil, xmlattr_acc = ::ActiveSupport::HashWithIndifferentAccess.new) ⇒ Object
-
#initialize(parent, **options, &block) ⇒ ProcTo
constructor
A new instance of ProcTo.
- #to_isomorphism(scope, record, instance = nil) ⇒ Object
Methods inherited from AbstractNode
Methods included from Internal::DeepEquals
Constructor Details
#initialize(parent, **options, &block) ⇒ ProcTo
Returns a new instance of ProcTo.
1117 1118 1119 1120 1121 |
# File 'lib/isomorphic/node.rb', line 1117 def initialize(parent, **, &block) # super(parent, **options) @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
1115 1116 1117 |
# File 'lib/isomorphic/node.rb', line 1115 def block @block end |
Instance Method Details
#from_isomorphism(scope, instance, record = nil, xmlattr_acc = ::ActiveSupport::HashWithIndifferentAccess.new) ⇒ Object
1123 1124 1125 |
# File 'lib/isomorphic/node.rb', line 1123 def from_isomorphism(scope, instance, record = nil, xmlattr_acc = ::ActiveSupport::HashWithIndifferentAccess.new) record end |
#to_isomorphism(scope, record, instance = nil) ⇒ Object
1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 |
# File 'lib/isomorphic/node.rb', line 1127 def to_isomorphism(scope, record, instance = nil) if block.nil? instance else case block.arity when 1 then block.call(record) when 2 then block.call(record, instance) when 3 then block.call(record, instance, scope) else record.instance_exec(instance, scope, &block) end end end |