Class: ClAdmin::Resource::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/cl_admin/resource/field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute:, name: nil, create: true, index: true, show: true, edit: true) ⇒ Field

Returns a new instance of Field.



6
7
8
9
10
11
12
13
# File 'lib/cl_admin/resource/field.rb', line 6

def initialize(attribute:, name: nil, create: true, index: true, show: true, edit: true)
  @attribute = attribute
  @name = name || attribute.titelize
  @create = create
  @index = index
  @show = show
  @edit = edit
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



4
5
6
# File 'lib/cl_admin/resource/field.rb', line 4

def attribute
  @attribute
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/cl_admin/resource/field.rb', line 4

def name
  @name
end

Instance Method Details

#display_on_create?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/cl_admin/resource/field.rb', line 19

def display_on_create?
  !!@create
end

#display_on_edit?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/cl_admin/resource/field.rb', line 27

def display_on_edit?
  !!@edit
end

#display_on_index?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/cl_admin/resource/field.rb', line 15

def display_on_index?
  !!@index
end

#display_on_show?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/cl_admin/resource/field.rb', line 23

def display_on_show?
  !!@show
end