class TableStructure::Schema::KeysBuilder
Public Class Methods
new(prefix: nil, suffix: nil)
click to toggle source
# File lib/table_structure/schema/keys_builder.rb, line 6 def initialize(prefix: nil, suffix: nil) @prefix = prefix @suffix = suffix end
Public Instance Methods
build(keys)
click to toggle source
# File lib/table_structure/schema/keys_builder.rb, line 11 def build(keys) return keys unless has_any_options? keys.map do |key| next key unless key decorated_key = "#{@prefix}#{key}#{@suffix}" key.is_a?(Symbol) ? decorated_key.to_sym : decorated_key end end
Private Instance Methods
has_any_options?()
click to toggle source
# File lib/table_structure/schema/keys_builder.rb, line 24 def has_any_options? @prefix || @suffix end