Class: ContentsCore::ItemInteger

Inherits:
Item show all
Defined in:
app/models/contents_core/item_integer.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Item

#as_json, #attr_id, #class_name, #config, #data_type, #editable, item_types, #opt_input, #process_data, #set

Class Method Details

.permitted_attributesObject



19
20
21
# File 'app/models/contents_core/item_integer.rb', line 19

def self.permitted_attributes
  [ :data_integer ]
end

.type_nameObject



23
24
25
# File 'app/models/contents_core/item_integer.rb', line 23

def self.type_name
  'integer'
end

Instance Method Details

#initObject



5
6
7
8
# File 'app/models/contents_core/item_integer.rb', line 5

def init
  self.data = 0
  self
end

#to_sObject



15
16
17
# File 'app/models/contents_core/item_integer.rb', line 15

def to_s
  self.data.to_s
end

#update_data(value) ⇒ Object



10
11
12
13
# File 'app/models/contents_core/item_integer.rb', line 10

def update_data( value )
  self.data = value.to_i
  self.save
end