Class: Ez::Resources::Manager::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/ez/resources/manager/field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Field

Returns a new instance of Field.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ez/resources/manager/field.rb', line 26

def initialize(options = {})
  @name          = options.delete(:name)
  @title         = options.delete(:title)      || @name.to_s.capitalize
  @type          = options.delete(:type)       || :string
  @required      = options.delete(:required)   || true
  @collection    = options.delete(:collection) || []
  @default       = options.delete(:default)
  @suffix        = options.delete(:suffix)
  @min           = options.delete(:min)
  @wrapper       = options.delete(:wrapper)
  @builder       = options.delete(:builder)
  @getter        = options.delete(:getter)
  @presenter     = options.delete(:presenter)
  @searchable    = options.delete(:searchable) != false
  @sortable      = options.delete(:sortable) || false
  @search_suffix = options.delete(:search_suffix) || :cont
  @search_label  = options.delete(:search_label)
  @options       = options # use for all other custom options
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def builder
  @builder
end

#collectionObject (readonly)

Returns the value of attribute collection.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def collection
  @collection
end

#defaultObject (readonly)

Returns the value of attribute default.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def default
  @default
end

#getterObject (readonly)

Returns the value of attribute getter.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def getter
  @getter
end

#minObject (readonly)

Returns the value of attribute min.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def min
  @min
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def options
  @options
end

#presenterObject (readonly)

Returns the value of attribute presenter.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def presenter
  @presenter
end

#requiredObject (readonly) Also known as: required?

Returns the value of attribute required.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def required
  @required
end

#search_labelObject (readonly)

Returns the value of attribute search_label.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def search_label
  @search_label
end

#search_suffixObject (readonly)

Returns the value of attribute search_suffix.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def search_suffix
  @search_suffix
end

#searchableObject (readonly)

Returns the value of attribute searchable.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def searchable
  @searchable
end

#sortableObject (readonly)

Returns the value of attribute sortable.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def sortable
  @sortable
end

#suffixObject (readonly)

Returns the value of attribute suffix.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def suffix
  @suffix
end

#titleObject (readonly)

Returns the value of attribute title.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def type
  @type
end

#wrapperObject (readonly)

Returns the value of attribute wrapper.



7
8
9
# File 'lib/ez/resources/manager/field.rb', line 7

def wrapper
  @wrapper
end