Class: Copyable::Declarations::Main

Inherits:
Object
  • Object
show all
Defined in:
lib/copyable/declarations/main.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#after_copy_blockObject (readonly)

Returns the value of attribute after_copy_block.



5
6
7
# File 'lib/copyable/declarations/main.rb', line 5

def after_copy_block
  @after_copy_block
end

#association_listObject (readonly)

Returns the value of attribute association_list.



5
6
7
# File 'lib/copyable/declarations/main.rb', line 5

def association_list
  @association_list
end

#column_listObject (readonly)

Returns the value of attribute column_list.



5
6
7
# File 'lib/copyable/declarations/main.rb', line 5

def column_list
  @column_list
end

Instance Method Details

#after_copy(&block) ⇒ Object



26
27
28
# File 'lib/copyable/declarations/main.rb', line 26

def after_copy(&block)
  @after_copy_block = block
end

#associations(associations) ⇒ Object



22
23
24
# File 'lib/copyable/declarations/main.rb', line 22

def associations(associations)
  @association_list = associations
end

#columns(columns) ⇒ Object



18
19
20
# File 'lib/copyable/declarations/main.rb', line 18

def columns(columns)
  @column_list = columns
end

#disable_all_callbacks_and_observers_except_validateObject

This declaration doesn’t actually do anything. It exists so that any copyable declaration must explicitly state that callbacks and observers are skipped (to make it easier to reason about the code when it is read).



15
16
# File 'lib/copyable/declarations/main.rb', line 15

def disable_all_callbacks_and_observers_except_validate
end

#execute(block) ⇒ Object



7
8
9
# File 'lib/copyable/declarations/main.rb', line 7

def execute(block)
  self.instance_eval(&block)
end