Sha256: 77b44fa6ada99e966b79557ecbe1bf95e44b9dfadfd7b25ce9357735fb896808

Contents?: true

Size: 655 Bytes

Versions: 2

Compression:

Stored size: 655 Bytes

Contents

# encoding: utf-8
require 'active_support/core_ext/object/inclusion'
require 'open_classes/string/heading_helper'

class String
  include HeadingHelper
  # Space4
  SPACE4 = '    '

  # create heading string with Emmet-like grammar.
  #
  # ==== Examples
  #
  # > case
  #
  #   'hoge>hige'.to_space4_heading # => 'hoge\n    hige'
  #
  # + case
  #
  #   'hoge+hige'.to_space4_heading # => 'hoge\nhige'
  #
  # ^ case
  #
  #   'hoge>hige^hege'.to_space4_heading # => 'hoge\n    hige\nhege'
  #
  def to_space4_heading
    heading = to_heading
    to_space4 heading
  end

  private
    def to_space4(heading)
      to_head(heading, SPACE4)
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.50 lib/open_classes/string/to_space4_heading.rb
tbpgr_utils-0.0.49 lib/open_classes/string/to_space4_heading.rb