Class: SampleModels::AttributeSequence::SimpleSource

Inherits:
AbstractSource show all
Defined in:
lib/sample_models/attribute_sequence.rb

Instance Method Summary collapse

Methods inherited from AbstractSource

#next

Constructor Details

#initialize(column) ⇒ SimpleSource

Returns a new instance of SimpleSource.



152
153
154
155
# File 'lib/sample_models/attribute_sequence.rb', line 152

def initialize(column)
  super()
  @column = column
end

Instance Method Details

#valueObject



157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/sample_models/attribute_sequence.rb', line 157

def value
  case @column.type
  when :string, :text
    "#{@column.name} #{@number}"
  when :integer
    @number
  when :datetime
    Time.now.utc - @number.minutes
  when :date
    Date.today - @number
  when :float
    @number.to_f
  end
end