Class: Browserbeam::PageState

Inherits:
Struct
  • Object
show all
Defined in:
lib/browserbeam/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#changesObject

Returns the value of attribute changes

Returns:

  • (Object)

    the current value of changes



46
47
48
# File 'lib/browserbeam/types.rb', line 46

def changes
  @changes
end

#formsObject

Returns the value of attribute forms

Returns:

  • (Object)

    the current value of forms



46
47
48
# File 'lib/browserbeam/types.rb', line 46

def forms
  @forms
end

#interactive_elementsObject

Returns the value of attribute interactive_elements

Returns:

  • (Object)

    the current value of interactive_elements



46
47
48
# File 'lib/browserbeam/types.rb', line 46

def interactive_elements
  @interactive_elements
end

#mapObject

Returns the value of attribute map

Returns:

  • (Object)

    the current value of map



46
47
48
# File 'lib/browserbeam/types.rb', line 46

def map
  @map
end

#markdownObject

Returns the value of attribute markdown

Returns:

  • (Object)

    the current value of markdown



46
47
48
# File 'lib/browserbeam/types.rb', line 46

def markdown
  @markdown
end

#scrollObject

Returns the value of attribute scroll

Returns:

  • (Object)

    the current value of scroll



46
47
48
# File 'lib/browserbeam/types.rb', line 46

def scroll
  @scroll
end

#stableObject

Returns the value of attribute stable

Returns:

  • (Object)

    the current value of stable



46
47
48
# File 'lib/browserbeam/types.rb', line 46

def stable
  @stable
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



46
47
48
# File 'lib/browserbeam/types.rb', line 46

def title
  @title
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



46
47
48
# File 'lib/browserbeam/types.rb', line 46

def url
  @url
end

Class Method Details

.from_hash(data) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/browserbeam/types.rb', line 47

def self.from_hash(data)
  return nil unless data.is_a?(Hash)
  new(
    url: data["url"] || "",
    title: data["title"] || "",
    stable: data["stable"] || false,
    markdown: MarkdownContent.from_hash(data["markdown"]),
    map: data["map"] ? data["map"].map { |m| MapEntry.from_hash(m) } : nil,
    interactive_elements: (data["interactive_elements"] || []).map { |el| InteractiveElement.from_hash(el) },
    forms: data["forms"] || [],
    changes: Changes.from_hash(data["changes"]),
    scroll: ScrollState.from_hash(data["scroll"]),
  )
end