Class: TableStructure::Schema::Table::KeyDecorator
- Inherits:
-
Object
- Object
- TableStructure::Schema::Table::KeyDecorator
- Defined in:
- lib/table_structure/schema/table/key_decorator.rb
Instance Method Summary collapse
- #decorate(keys) ⇒ Object
-
#initialize(prefix: nil, suffix: nil) ⇒ KeyDecorator
constructor
A new instance of KeyDecorator.
Constructor Details
#initialize(prefix: nil, suffix: nil) ⇒ KeyDecorator
7 8 9 10 |
# File 'lib/table_structure/schema/table/key_decorator.rb', line 7 def initialize(prefix: nil, suffix: nil) @prefix = prefix @suffix = suffix end |
Instance Method Details
#decorate(keys) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/table_structure/schema/table/key_decorator.rb', line 12 def decorate(keys) return keys unless keys.map do |key| next key unless key decorated_key = "#{@prefix}#{key}#{@suffix}" decorated_key = decorated_key.to_sym if key.is_a?(Symbol) decorated_key end end |