Module: Recline

Defined in:
lib/recline.rb,
lib/recline/model.rb,
lib/recline/railtie.rb,
lib/recline/version.rb,
lib/recline/appearance.rb

Defined Under Namespace

Classes: Appearance, AttributeReflection, Model, ModelReflection, Railtie

Constant Summary collapse

VERSION =
'0.0.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.default_appearance_typesObject

Returns the value of attribute default_appearance_types.



23
24
25
# File 'lib/recline.rb', line 23

def default_appearance_types
  @default_appearance_types
end

.fallback_appearanceObject

Returns the value of attribute fallback_appearance.



22
23
24
# File 'lib/recline.rb', line 22

def fallback_appearance
  @fallback_appearance
end

.schema_name_prefixObject

Returns the value of attribute schema_name_prefix.



21
22
23
# File 'lib/recline.rb', line 21

def schema_name_prefix
  @schema_name_prefix
end

Class Method Details

.appearance_for(klass, name) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/recline.rb', line 4

def self.appearance_for(klass, name)
  if klass.respond_to? :recline_appearance
    klass.recline_appearance(@name)
  else
    db_type = klass.type_for_attribute(name.to_s).type
    if default_appearance_types.key? db_type
      default_appearance_types[db_type]
    else
      fallback_appearance
    end
  end
end