require "active_support"
require "active_support/core_ext"
require "yaml"

require "hexflex/hexaflexagon"

module Hexflex

  RADIUS = 1.0
  BASE = Math::sqrt(3)
  HEIGHT = 1.5
  HEIGHT_AFTER_RADIUS = HEIGHT - RADIUS
  HALF_BASE = BASE / 2

  class << self
    def make_template_image(opts = {})
      output_file_name = opts.delete(:output_file_name)
      template = Hexaflexagon.new(opts).as_template
      template.save(output_file_name)
    end
  end
end

require "active_support"
require "active_support/core_ext"
require "yaml"

require "hexflex/hexaflexagon"

module Hexflex

  RADIUS = 1.0
  BASE = Math::sqrt(3)
  HEIGHT = 1.5
  HEIGHT_AFTER_RADIUS = HEIGHT - RADIUS
  HALF_BASE = BASE / 2

  class << self
    def make_template(opts = {})
      Hexaflexagon.new(opts).as_template
    end

    def make_template_image(opts = {})
      output_file_name = opts.delete(:output_file_name)
      template = make_template(opts)
      template.save(output_file_name)
    end
  end
end

Refactor out just creating a template and saving the image at the module level
Refactor out just creating a template and saving the image at the module level
