Class: PgMeta::Trigger
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Array of events (:insert, :update, :delete, or :truncate) causing the trigger to fire.
-
#function ⇒ Object
readonly
Trigger function.
-
#level ⇒ Object
readonly
Trigger level (:stmt or :row).
-
#timing ⇒ Object
readonly
When trigger is fired (:before, :after, or :instead).
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(table, name, function, level, timing, events) ⇒ Trigger
constructor
Note that trigger names have a ‘()’ suffixed.
- #to_h ⇒ Object
Methods inherited from Node
#dump, #dump_value, #guid, #inspect, #sid, #to_s, #to_yaml, #uid
Constructor Details
#initialize(table, name, function, level, timing, events) ⇒ Trigger
Note that trigger names have a ‘()’ suffixed. This avoid namespace collisions with field names
577 578 579 580 581 582 583 584 585 |
# File 'lib/pg_meta/meta.rb', line 577 def initialize(table, name, function, level, timing, events) super(table, name) @name = "#{name}()" @function = function @level = level.to_sym @timing = timing.to_sym @events = events table.triggers[@name] = self end |
Instance Attribute Details
#events ⇒ Object (readonly)
Array of events (:insert, :update, :delete, or :truncate) causing the trigger to fire
573 574 575 |
# File 'lib/pg_meta/meta.rb', line 573 def events @events end |
#function ⇒ Object (readonly)
Trigger function
564 565 566 |
# File 'lib/pg_meta/meta.rb', line 564 def function @function end |
#level ⇒ Object (readonly)
Trigger level (:stmt or :row)
567 568 569 |
# File 'lib/pg_meta/meta.rb', line 567 def level @level end |
#timing ⇒ Object (readonly)
When trigger is fired (:before, :after, or :instead)
570 571 572 |
# File 'lib/pg_meta/meta.rb', line 570 def timing @timing end |
Instance Method Details
#to_h ⇒ Object
587 |
# File 'lib/pg_meta/meta.rb', line 587 def to_h() attrs_to_h(:name, :function, :level, :timing, :events) end |