Class: Librails::FormParam

Inherits:
Object
  • Object
show all
Defined in:
lib/librails/form_param.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, label = nil, value = nil) ⇒ FormParam

Returns a new instance of FormParam.



3
4
5
6
7
8
9
10
11
# File 'lib/librails/form_param.rb', line 3

def initialize(id, label = nil, value = nil)
  # 基本はIDとlabel。valueは特別な値を紐付けたい場合にのみ使用する。
  @id = id
  @label = label
  if @label.nil?
    @label = @id
  end
  @value = value
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



12
13
14
# File 'lib/librails/form_param.rb', line 12

def id
  @id
end

#labelObject

Returns the value of attribute label.



12
13
14
# File 'lib/librails/form_param.rb', line 12

def label
  @label
end

#valueObject

Returns the value of attribute value.



12
13
14
# File 'lib/librails/form_param.rb', line 12

def value
  @value
end