Class: Isomorphic::Node::ProcFrom
- Inherits:
-
AbstractNode
- Object
- AbstractNode
- Isomorphic::Node::ProcFrom
- 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) ⇒ ProcFrom
constructor
A new instance of ProcFrom.
- #to_isomorphism(scope, record, instance = nil) ⇒ Object
Methods inherited from AbstractNode
Methods included from Internal::DeepEquals
Constructor Details
#initialize(parent, **options, &block) ⇒ ProcFrom
Returns a new instance of ProcFrom.
1089 1090 1091 1092 1093 |
# File 'lib/isomorphic/node.rb', line 1089 def initialize(parent, **, &block) # super(parent, **options) @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
1087 1088 1089 |
# File 'lib/isomorphic/node.rb', line 1087 def block @block end |
Instance Method Details
#from_isomorphism(scope, instance, record = nil, xmlattr_acc = ::ActiveSupport::HashWithIndifferentAccess.new) ⇒ Object
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 |
# File 'lib/isomorphic/node.rb', line 1095 def from_isomorphism(scope, instance, record = nil, xmlattr_acc = ::ActiveSupport::HashWithIndifferentAccess.new) if block.nil? record else case block.arity when 1 then block.call(instance) when 2 then block.call(instance, record) when 3 then block.call(instance, record, xmlattr_acc) when 4 then block.call(instance, record, xmlattr_acc, scope) else instance.instance_exec(record, xmlattr_acc, scope, &block) end end end |
#to_isomorphism(scope, record, instance = nil) ⇒ Object
1109 1110 1111 |
# File 'lib/isomorphic/node.rb', line 1109 def to_isomorphism(scope, record, instance = nil) instance end |