Class: Witsec::Schema
- Inherits:
-
Object
- Object
- Witsec::Schema
- Defined in:
- lib/witsec/schema.rb
Instance Attribute Summary collapse
-
#anonymized_tables ⇒ Object
readonly
Returns the value of attribute anonymized_tables.
-
#excluded_tables ⇒ Object
readonly
Returns the value of attribute excluded_tables.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #anonymize_table(name, &block) ⇒ Object
- #anonymizes?(table_name) ⇒ Boolean
- #define(&block) ⇒ Object
- #exclude_table(name) ⇒ Object
- #include_table(name) ⇒ Object
-
#initialize(version) ⇒ Schema
constructor
A new instance of Schema.
- #table_names ⇒ Object
Constructor Details
#initialize(version) ⇒ Schema
Returns a new instance of Schema.
9 10 11 12 13 |
# File 'lib/witsec/schema.rb', line 9 def initialize(version) @version = version @anonymized_tables = [] @excluded_tables = [] end |
Instance Attribute Details
#anonymized_tables ⇒ Object (readonly)
Returns the value of attribute anonymized_tables.
15 16 17 |
# File 'lib/witsec/schema.rb', line 15 def anonymized_tables @anonymized_tables end |
#excluded_tables ⇒ Object (readonly)
Returns the value of attribute excluded_tables.
15 16 17 |
# File 'lib/witsec/schema.rb', line 15 def excluded_tables @excluded_tables end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
15 16 17 |
# File 'lib/witsec/schema.rb', line 15 def version @version end |
Class Method Details
.define(version, &block) ⇒ Object
4 5 6 |
# File 'lib/witsec/schema.rb', line 4 def define(version, &block) new(version).define(&block) end |
Instance Method Details
#anonymize_table(name, &block) ⇒ Object
31 32 33 34 35 |
# File 'lib/witsec/schema.rb', line 31 def anonymize_table(name, &block) anonymized_tables << Table.new(name).define do instance_eval(&block) end end |
#anonymizes?(table_name) ⇒ Boolean
37 38 39 |
# File 'lib/witsec/schema.rb', line 37 def anonymizes?(table_name) anonymized_table_names.include?(table_name) end |
#define(&block) ⇒ Object
17 18 19 20 21 |
# File 'lib/witsec/schema.rb', line 17 def define(&block) instance_eval(&block) self end |
#exclude_table(name) ⇒ Object
23 24 25 |
# File 'lib/witsec/schema.rb', line 23 def exclude_table(name) excluded_tables << name end |
#include_table(name) ⇒ Object
27 28 29 |
# File 'lib/witsec/schema.rb', line 27 def include_table(name) anonymized_tables << Table.new(name) end |
#table_names ⇒ Object
41 42 43 |
# File 'lib/witsec/schema.rb', line 41 def table_names (anonymized_table_names + excluded_tables).sort end |