Class: PageBuilder::Elements::Input

Inherits:
Basic
  • Object
show all
Defined in:
lib/pagebuilder/elements/input.rb

Overview

Creates anchor nodes and adds some helper methods for commonly used attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Basic

#configure, #data_attributes=

Class Method Details

.new(parent_or_doc) ⇒ Object

We have to override #new because nokogiri creates the nodes before calling initialize

Parameters:

  • parent_or_doc (Nokogiri::XML::Node, Nokogiri::XML::Document)

    something to pull the current document from



13
14
15
# File 'lib/pagebuilder/elements/input.rb', line 13

def self.new(parent_or_doc)
  super('input', parent_or_doc)
end

Instance Method Details

#typeString?

Gets the current type attribute’s value

Returns:

  • (String, nil)


19
20
21
# File 'lib/pagebuilder/elements/input.rb', line 19

def type
  self['type']
end

#type=(type) ⇒ Object

Sets the type attribute’s value

Parameters:

  • type (String)

    the type of the input

Returns:

  • void



26
27
28
# File 'lib/pagebuilder/elements/input.rb', line 26

def type=(type)
  self['type'] = type
end

#valueString?

Gets the current value attribute’s value

Returns:

  • (String, nil)


32
33
34
# File 'lib/pagebuilder/elements/input.rb', line 32

def value
  self['value']
end

#value=(value) ⇒ Object

Sets the value attribute’s value

Parameters:

  • value (String)

    the value for this input

Returns:

  • void



39
40
41
# File 'lib/pagebuilder/elements/input.rb', line 39

def value=(value)
  self['value'] = value
end