Sha256: a82e2caf30d562146476e01d109b2f59cc39ee5a1b8a527506db41c24c3196ea

Contents?: true

Size: 697 Bytes

Versions: 35

Compression:

Stored size: 697 Bytes

Contents

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

class String
  include HeadingHelper
  # Hatena
  HATENA = '*'

  # create heading string with Emmet-like syntax.
  #
  # ==== Examples
  #
  # > case
  #
  #   'hoge>hige'.to_hatena_heading # => '*hoge\n**hige'
  #
  # + case
  #
  #   'hoge+hige'.to_hatena_heading # => '*hoge\n*hige'
  #
  # ^ case
  #
  #   'hoge>hige^hege'.to_hatena_heading # => '*hoge\n**hige\n*hege'
  #
  def to_hatena_heading
    heading = to_heading
    to_hatena heading
  end

  private
  def to_hatena(heading)
    to_head(heading, HATENA, start_level: 1)
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.151 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.150 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.149 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.148 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.147 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.146 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.145 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.144 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.143 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.142 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.141 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.140 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.139 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.138 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.137 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.136 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.135 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.134 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.133 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.132 lib/open_classes/string/to_hatena_heading.rb