class Borrower::Merge

Public Class Methods

new(content, options={}) click to toggle source
# File lib/borrower/merge.rb, line 4
def initialize content, options={}
  @content = content
  @comment_symbol = pick_comment_symbol options
end

Public Instance Methods

output() click to toggle source
# File lib/borrower/merge.rb, line 9
def output
  merge_borrow_statements
end

Private Instance Methods

contents_from_file(path) click to toggle source
# File lib/borrower/merge.rb, line 27
def contents_from_file path
  Content.get(path)
end
merge_borrow_statements() click to toggle source
# File lib/borrower/merge.rb, line 21
def merge_borrow_statements
  @content.gsub /(?:#{@comment_symbol})= borrow '(.*?)'/ do |match|
    contents_from_file($1)
  end
end
pick_comment_symbol(options) click to toggle source
# File lib/borrower/merge.rb, line 15
def pick_comment_symbol options
  options.fetch(:comment) do
    CommentSymbol.find_symbol_for options.fetch(:type) { "default" }
  end
end