Class: Liquidum::ConversionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/liquidum/conversions_controller.rb

Defined Under Namespace

Classes: Conversion

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/liquidum/conversions_controller.rb', line 12

def create
  if params[:json_to_yaml] == 'commit'
    @conversion.result = YAML.dump(JSON.parse(@conversion.source))
  elsif params[:yaml_to_json] == 'commit'
    @conversion.result = JSON.pretty_generate(Psych.load(@conversion.source))
  elsif params[:slim_to_html] == 'commit'
    @conversion.result = Slim::Template.new({ pretty: true }) { @conversion.source }.render
  end

  render :index, status: 302
end

#indexObject



10
# File 'app/controllers/liquidum/conversions_controller.rb', line 10

def index; end