Class: Cloned::Base
Class Attribute Summary collapse
-
.strategy ⇒ Object
Returns the value of attribute strategy.
Instance Attribute Summary collapse
-
#copy ⇒ Object
readonly
Returns the value of attribute copy.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Attributes included from DSL
Instance Method Summary collapse
-
#initialize(target:, destination: nil, **options) ⇒ Base
constructor
A new instance of Base.
- #make ⇒ Object
- #valid? ⇒ Boolean
Methods included from DSL
Constructor Details
#initialize(target:, destination: nil, **options) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 |
# File 'lib/cloned/base.rb', line 8 def initialize(target:, destination: nil, **) @target = target @destination = destination @options = end |
Class Attribute Details
.strategy ⇒ Object
Returns the value of attribute strategy.
46 47 48 |
# File 'lib/cloned/base.rb', line 46 def strategy @strategy end |
Instance Attribute Details
#copy ⇒ Object (readonly)
Returns the value of attribute copy.
5 6 7 |
# File 'lib/cloned/base.rb', line 5 def copy @copy end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
5 6 7 |
# File 'lib/cloned/base.rb', line 5 def destination @destination end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/cloned/base.rb', line 5 def @options end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
5 6 7 |
# File 'lib/cloned/base.rb', line 5 def target @target end |
Instance Method Details
#make ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/cloned/base.rb', line 14 def make if skip_transaction? make_or_fail! else ActiveRecord::Base.transaction { make_or_fail! } end copy end |
#valid? ⇒ Boolean
23 24 25 |
# File 'lib/cloned/base.rb', line 23 def valid? target.presence end |