Class: MarkdownExec::LinkState

Inherits:
Object
  • Object
show all
Defined in:
lib/link_history.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block_name: nil, display_menu: nil, document_filename: nil, inherited_block_names: [], inherited_dependencies: nil, inherited_lines: nil, prior_block_was_link: nil) ⇒ LinkState

Initialize the LinkState with keyword arguments for each attribute.

Parameters:

  • block_name (String, nil) (defaults to: nil)

    the name of the block.

  • document_filename (String, nil) (defaults to: nil)

    the filename of the document.

  • inherited_block_names (Array<String>, nil) (defaults to: [])

    the names of the inherited blocks.

  • inherited_dependencies (?, nil) (defaults to: nil)

    the dependecy hierarcy.

  • inherited_lines (Array<String>, nil) (defaults to: nil)

    the inherited lines of code.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/link_history.rb', line 17

def initialize(block_name: nil, display_menu: nil, document_filename: nil,
               inherited_block_names: [], inherited_dependencies: nil, inherited_lines: nil,
               prior_block_was_link: nil)
  @block_name = block_name
  @display_menu = display_menu
  @document_filename = document_filename
  @inherited_block_names = inherited_block_names
  @inherited_dependencies = inherited_dependencies
  @inherited_lines = inherited_lines
  @prior_block_was_link = prior_block_was_link
end

Instance Attribute Details

#block_nameObject

Returns the value of attribute block_name.



7
8
9
# File 'lib/link_history.rb', line 7

def block_name
  @block_name
end

#display_menuObject

Returns the value of attribute display_menu.



7
8
9
# File 'lib/link_history.rb', line 7

def display_menu
  @display_menu
end

#document_filenameObject

Returns the value of attribute document_filename.



7
8
9
# File 'lib/link_history.rb', line 7

def document_filename
  @document_filename
end

#inherited_block_namesObject

Returns the value of attribute inherited_block_names.



7
8
9
# File 'lib/link_history.rb', line 7

def inherited_block_names
  @inherited_block_names
end

#inherited_dependenciesObject

Returns the value of attribute inherited_dependencies.



7
8
9
# File 'lib/link_history.rb', line 7

def inherited_dependencies
  @inherited_dependencies
end

#inherited_linesObject

Returns the value of attribute inherited_lines.



7
8
9
# File 'lib/link_history.rb', line 7

def inherited_lines
  @inherited_lines
end

Returns the value of attribute prior_block_was_link.



7
8
9
# File 'lib/link_history.rb', line 7

def prior_block_was_link
  @prior_block_was_link
end

Class Method Details

.emptyLinkState

Creates an empty LinkState instance.

Returns:

  • (LinkState)

    an instance with all attributes set to their default values.



31
32
33
# File 'lib/link_history.rb', line 31

def self.empty
  new
end

Instance Method Details

#==(other) ⇒ Boolean

Custom equality method to compare LinkState objects.

Parameters:

  • other (LinkState)

    the other LinkState object to compare with.

Returns:

  • (Boolean)

    true if the objects are equal, false otherwise.



38
39
40
41
42
43
44
45
46
47
# File 'lib/link_history.rb', line 38

def ==(other)
  other.class == self.class &&
    other.block_name == block_name &&
    other.display_menu == display_menu &&
    other.document_filename == document_filename &&
    other.inherited_block_names == inherited_block_names &&
    other.inherited_dependencies == inherited_dependencies &&
    other.inherited_lines == inherited_lines &&
    other.prior_block_was_link == prior_block_was_link
end