Class: AnixeCsv::Formatter::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/anixe_csv/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Field

Returns a new instance of Field.



161
162
163
164
# File 'lib/anixe_csv/formatter.rb', line 161

def initialize(*args)
	@name = args[0]
	@value = @default = args[1] unless args[1].nil?
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



159
160
161
# File 'lib/anixe_csv/formatter.rb', line 159

def block
  @block
end

#defaultObject

Returns the value of attribute default.



159
160
161
# File 'lib/anixe_csv/formatter.rb', line 159

def default
  @default
end

#nameObject

Returns the value of attribute name.



159
160
161
# File 'lib/anixe_csv/formatter.rb', line 159

def name
  @name
end

#regexpObject

Returns the value of attribute regexp.



159
160
161
# File 'lib/anixe_csv/formatter.rb', line 159

def regexp
  @regexp
end

#valueObject

Returns the value of attribute value.



159
160
161
# File 'lib/anixe_csv/formatter.rb', line 159

def value
  @value
end

Instance Method Details

#to_sObject



166
167
168
169
170
171
172
# File 'lib/anixe_csv/formatter.rb', line 166

def to_s
	unless block.nil?
		block.call(self.value, self)
	else
		value
	end
end