Sha256: 58a56dee18db8c971f677b6661376c4e543e580ffbc17a2b3da3de997538383d

Contents?: true

Size: 668 Bytes

Versions: 66

Compression:

Stored size: 668 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

66 entries across 66 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.116 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.115 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.114 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.113 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.112 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.111 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.110 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.109 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.108 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.107 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.106 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.105 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.104 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.103 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.102 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.101 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.100 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.99 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.98 lib/open_classes/string/to_hatena_heading.rb
tbpgr_utils-0.0.97 lib/open_classes/string/to_hatena_heading.rb