Class: Liquigen::Handlers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/liquigen/handlers/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, props) ⇒ Base

Returns a new instance of Base.



17
18
19
20
21
22
23
# File 'lib/liquigen/handlers/base.rb', line 17

def initialize(table, props)
  self.table = table
  self.props = props
  self.sets = []

  self.id = build_id
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



15
16
17
# File 'lib/liquigen/handlers/base.rb', line 15

def id
  @id
end

#propsObject

Returns the value of attribute props.



12
13
14
# File 'lib/liquigen/handlers/base.rb', line 12

def props
  @props
end

#setsObject

Returns the value of attribute sets.



13
14
15
# File 'lib/liquigen/handlers/base.rb', line 13

def sets
  @sets
end

#tableObject

Returns the value of attribute table.



11
12
13
# File 'lib/liquigen/handlers/base.rb', line 11

def table
  @table
end

Instance Method Details

#processObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/liquigen/handlers/base.rb', line 25

def process
  set = Liquigen::ChangeSet.new(id)
  build_one_changeset(set)
  sets << set

  file_path = build_file_name
  File.open(file_path, 'w+') { |f| f.write(sets.to_yaml(indentation: 4)) }

  process_lines file_path
end