arrange indent

master
Kanezoh 2021-07-15 09:00:23 +09:00
parent f2434a4c5a
commit 6ff9590f48
4 changed files with 20 additions and 19 deletions

View File

@ -1,15 +1,15 @@
class MechanizeCr::FormContent::Field class MechanizeCr::FormContent::Field
getter :node
property value : String? property value : String?
getter name : String getter name : String
getter type : String getter type : String
getter raw_value : String? getter raw_value : String?
getter node : Node | Myhtml::Node
def initialize(node : Node | Myhtml::Node, value=nil) def initialize(node : Node | Myhtml::Node, value=nil)
@node = node @node = node
@name = node.fetch("name", "") @name = node.fetch("name", "")
@value = value || node.fetch("value", nil) @value = value || node.fetch("value", nil)
@type = node.fetch("type", "") @type = node.fetch("type", "")
@raw_value = @value @raw_value = @value
end end

View File

@ -2,16 +2,16 @@ require "./option"
class MechanizeCr::FormContent::MultiSelectList class MechanizeCr::FormContent::MultiSelectList
getter node : Myhtml::Node getter node : Myhtml::Node
property values : Array(String)
getter name : String getter name : String
getter type : String getter type : String
property values : Array(String)
property options : Array(FormContent::Option) property options : Array(FormContent::Option)
def initialize(node : Myhtml::Node) def initialize(node : Myhtml::Node)
@node = node @node = node
@name = node.fetch("name", "") @name = node.fetch("name", "")
@type = node.fetch("type", "") @type = node.fetch("type", "")
@values = Array(String).new @values = Array(String).new
@options = Array(FormContent::Option).new @options = Array(FormContent::Option).new
node.css("option").each { |n| node.css("option").each { |n|
@options << FormContent::Option.new(n, self) @options << FormContent::Option.new(n, self)

View File

@ -1,14 +1,15 @@
class MechanizeCr::FormContent::Option class MechanizeCr::FormContent::Option
getter select_list : FormContent::MultiSelectList getter select_list : FormContent::MultiSelectList
getter node : Myhtml::Node getter node : Myhtml::Node
getter text : String getter text : String
getter value : String getter value : String
getter selected : Bool getter selected : Bool
def initialize(node, select_list) def initialize(node, select_list)
@node = node @node = node
@text = node.inner_text @text = node.inner_text
@value = (node["value"] || node.inner_text) @value = (node["value"] || node.inner_text)
@selected = node.has_key?("selected") @selected = node.has_key?("selected")
@select_list = select_list # The select list this option belongs to @select_list = select_list # The select list this option belongs to
end end

View File

@ -3,7 +3,7 @@ class MechanizeCr::FormContent::RadioButton < MechanizeCr::FormContent::Field
def initialize(node : Node | Myhtml::Node, form : Form) def initialize(node : Node | Myhtml::Node, form : Form)
@checked = !!node.fetch("checked", nil) @checked = !!node.fetch("checked", nil)
@form = form @form = form
super(node) super(node)
end end