Sha256: b5437f798d8312eb5764a71799135c75cc0ce01dd4efd0fa1950248f884de5e8
Contents?: true
Size: 838 Bytes
Versions: 2
Compression:
Stored size: 838 Bytes
Contents
# frozen_string_literal: true require 'rubocop' require 'pp' require 'tempfile' module Flare module Controllers module Documentation module Formatter def self.to_s_and_format(ruby_object) code = PP.pp(ruby_object, String.new) format_code(code) end def self.format_code(code) Tempfile.create(['code', '.rb']) do |file| file.write(code) file.flush options = { autocorrect: true, formatters: [], cache: false } config_store = RuboCop::ConfigStore.new config_store.options_config = './docs/templates/.rubocop.yml' runner = RuboCop::Runner.new(options, config_store) runner.run([file.path]) File.read(file.path).strip end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
datomic-flare-1.0.1 | controllers/documentation/formatter.rb |
datomic-flare-1.0.0 | controllers/documentation/formatter.rb |