class Octopress::Tags::CaptionedImageTag::CaptionOptionsParser

Constants

Chrome
Clear
DEFAULT_POSITION
Dimensions
Float
Position
Source

Attributes

chrome[R]
clear[R]
float[R]
height[R]
position[R]
source[R]
width[R]

Public Class Methods

new(markup) click to toggle source
# File lib/octo-captioned-image/caption_options_parser.rb, line 16
def initialize(markup)
        @markup = markup

        parse_source
        raise "No source image (png, gif, bmp, or jpeg) found in #{@markup}" unless @source

        parse_position
        parse_float
        parse_clear
        parse_dimensions
        parse_chrome
end

Private Instance Methods

parse_chrome() click to toggle source
# File lib/octo-captioned-image/caption_options_parser.rb, line 53
                        def parse_chrome
  @chrome = @markup =~ Chrome
end
parse_clear() click to toggle source
# File lib/octo-captioned-image/caption_options_parser.rb, line 43
def parse_clear
  @clear = @markup.scan(Clear).flatten.last
end
parse_dimensions() click to toggle source
# File lib/octo-captioned-image/caption_options_parser.rb, line 47
def parse_dimensions
  dimensions = @markup.scan(Dimensions).map(&:first).compact
  @width = dimensions[0]
  @height = dimensions[1]
end
parse_float() click to toggle source
# File lib/octo-captioned-image/caption_options_parser.rb, line 39
def parse_float
  @float = @markup.scan(Float).flatten.last
end
parse_position() click to toggle source
# File lib/octo-captioned-image/caption_options_parser.rb, line 35
def parse_position
  @position = @markup.scan(Position).flatten.last || DEFAULT_POSITION
end
parse_source() click to toggle source
# File lib/octo-captioned-image/caption_options_parser.rb, line 31
def parse_source
  @source = @markup.scan(Source).map(&:first).compact
end