Sha256: 2016fcc204f19fc49d8cb480f3fd5fcc3ea27f122a46b6253f0e9df11d6528a8
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true module ThemeCheck class Corrector def initialize(template:) @template = template end def insert_after(node, content) line = @template.full_line(node.line_number) line.insert(node.range[1] + 1, content) end def insert_before(node, content) line = @template.full_line(node.line_number) line.insert(node.range[0], content) end def replace(node, content) line = @template.full_line(node.line_number) line[node.range[0]..node.range[1]] = content node.markup = content end def wrap(node, insert_before, insert_after) line = @template.full_line(node.line_number) line.insert(node.range[0], insert_before) line.insert(node.range[1] + 1 + insert_before.length, insert_after) end def create(theme, relative_path, content) theme.storage.write(relative_path, content) end def create_default_locale_json(theme) theme.default_locale_json = JsonFile.new("locales/#{theme.default_locale}.default.json", theme.storage) theme.default_locale_json.update_contents('{}') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
theme-check-1.5.1 | lib/theme_check/corrector.rb |
theme-check-1.5.0 | lib/theme_check/corrector.rb |
theme-check-1.4.0 | lib/theme_check/corrector.rb |