module ActiveMocker::MockCreator::ClassMethods
Public Instance Methods
abstract_class()
click to toggle source
# File lib/active_mocker/mock_creator/class_methods.rb, line 40 def abstract_class schema_scrapper.abstract_class? end
associations()
click to toggle source
# File lib/active_mocker/mock_creator/class_methods.rb, line 22 def associations @associations ||= schema_scrapper.associations.to_a.each_with_object({}) do |a, h| h[a.name] = nil end end
associations_by_class()
click to toggle source
# File lib/active_mocker/mock_creator/class_methods.rb, line 28 def associations_by_class schema_scrapper.associations.to_a.each_with_object({}) do |r, hash| hash[r.class_name.to_s] ||= {} hash[r.class_name.to_s][r.type] ||= [] hash[r.class_name.to_s][r.type] << r.name end end
attribute_names()
click to toggle source
# File lib/active_mocker/mock_creator/class_methods.rb, line 36 def attribute_names attributes.map(&:name) end
attributes_with_defaults()
click to toggle source
# File lib/active_mocker/mock_creator/class_methods.rb, line 9 def attributes_with_defaults types_hash attributes.each_with_object({}) do |attr, hash| hash[attr.name] = attr.default end end
mocked_class()
click to toggle source
# File lib/active_mocker/mock_creator/class_methods.rb, line 48 def mocked_class [nested_modules, class_name].compact.reject(&:empty?).join("::") end
table_name()
click to toggle source
# File lib/active_mocker/mock_creator/class_methods.rb, line 44 def table_name schema_scrapper.table_name end
types_hash()
click to toggle source
# File lib/active_mocker/mock_creator/class_methods.rb, line 16 def types_hash @types_hash ||= attributes.each_with_object(HashNewStyle.new) do |attr, types| types[attr.name] = attr.type.to_s end.inspect end