Class: Togglate::BlockWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/togglate/block_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, wrapper: %w(<!--original -->), pretext: "[translation here]", wrap_exceptions: [], **opts) ⇒ BlockWrapper

Returns a new instance of BlockWrapper.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/togglate/block_wrapper.rb', line 4

def initialize(text,
               wrapper:%w(<!--original -->),
               pretext:"[translation here]",
               wrap_exceptions:[],
               **opts)
  @text = text
  @wrapper = wrapper
  @pretext = pretext
  @wrap_exceptions = wrap_exceptions
  @translate = set_translate_opt(opts[:translate])
  @timeout = opts.fetch(:timeout, 5)
  @email = opts[:email]
  @indent_re = /^\s{4,}\S/
end

Instance Method Details

#runObject



19
20
21
# File 'lib/togglate/block_wrapper.rb', line 19

def run
  wrap_chunks build_chunks
end