Class: Card::Set::All::ReferenceEditor::LinkEditor::LinkParser

Inherits:
Object
  • Object
show all
Defined in:
card/tmpsets/set/mod037-card-mod-tinymce_editor/all/reference_editor/link_editor/link_parser.rb,
card/tmpsets/set/mod038-card-mod-tinymce_editor/all/reference_editor/link_editor/link_parser.rb

Overview

from a link syntax string

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(link_string) ⇒ LinkParser

Returns a new instance of LinkParser.



20
21
22
23
24
25
# File 'card/tmpsets/set/mod037-card-mod-tinymce_editor/all/reference_editor/link_editor/link_parser.rb', line 20

def initialize link_string
  @raw = link_string
  link = Card::Content::Chunk::Link.new link_string, nil
  init_name link.name
  @options = link.options
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



12
13
14
# File 'card/tmpsets/set/mod037-card-mod-tinymce_editor/all/reference_editor/link_editor/link_parser.rb', line 12

def field
  @field
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'card/tmpsets/set/mod037-card-mod-tinymce_editor/all/reference_editor/link_editor/link_parser.rb', line 12

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'card/tmpsets/set/mod037-card-mod-tinymce_editor/all/reference_editor/link_editor/link_parser.rb', line 12

def options
  @options
end

#rawObject (readonly)

Returns the value of attribute raw.



12
13
14
# File 'card/tmpsets/set/mod037-card-mod-tinymce_editor/all/reference_editor/link_editor/link_parser.rb', line 12

def raw
  @raw
end

Class Method Details

.new(link_string) ⇒ Object



14
15
16
17
18
# File 'card/tmpsets/set/mod037-card-mod-tinymce_editor/all/reference_editor/link_editor/link_parser.rb', line 14

def self.new link_string
  return super if link_string.is_a? String

  OpenStruct.new(name: "", options: {}, raw: "[[ ]]")
end

Instance Method Details

#field?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'card/tmpsets/set/mod037-card-mod-tinymce_editor/all/reference_editor/link_editor/link_parser.rb', line 31

def field?
  @field
end

#titleObject



27
28
29
# File 'card/tmpsets/set/mod037-card-mod-tinymce_editor/all/reference_editor/link_editor/link_parser.rb', line 27

def title
  @options && @options[:title]
end