Module: TableStructure::Schema::Utils
- Defined in:
- lib/table_structure/schema/utils.rb
Class Method Summary collapse
- .concat_key(key, prefix, suffix) ⇒ Object
- .evaluate_callable(val, *params) ⇒ Object
- .schema_class?(val) ⇒ Boolean
- .schema_instance?(val) ⇒ Boolean
Class Method Details
.concat_key(key, prefix, suffix) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/table_structure/schema/utils.rb', line 10 def self.concat_key(key, prefix, suffix) case key when Symbol "#{prefix}#{key}#{suffix}".to_sym else "#{prefix}#{key}#{suffix}" end end |
.evaluate_callable(val, *params) ⇒ Object
6 7 8 |
# File 'lib/table_structure/schema/utils.rb', line 6 def self.evaluate_callable(val, *params) val.respond_to?(:call) ? val.call(*params) : val end |
.schema_class?(val) ⇒ Boolean
19 20 21 22 |
# File 'lib/table_structure/schema/utils.rb', line 19 def self.schema_class?(val) val.is_a?(Class) && val.included_modules.include?(::TableStructure::Schema) end |
.schema_instance?(val) ⇒ Boolean
24 25 26 |
# File 'lib/table_structure/schema/utils.rb', line 24 def self.schema_instance?(val) val.is_a?(::TableStructure::Schema) end |