refactor form#initialize

master
Kanezoh 2021-06-11 09:18:29 +09:00
parent f09d0715a3
commit 1e7ebdd354
1 changed files with 6 additions and 7 deletions

View File

@ -9,18 +9,17 @@ class MechanizeCr::Form
property action : String
def initialize(node : Node | Myhtml::Node)
@enctype = node["enctype"]? ? node["enctype"] : "application/x-www-form-urlencoded"
@enctype = node.fetch("enctype", "application/x-www-form-urlencoded")
@node = node
@fields = Array(MechanizeCr::FormContent::Field).new
@checkboxes = Array(MechanizeCr::FormContent::CheckBox).new
#@action = Mechanize::Util.html_unescape(node['action'])
@action = node["action"]
@method = (node["method"] || "GET").upcase
@fields = Array(MechanizeCr::FormContent::Field).new
@checkboxes = Array(MechanizeCr::FormContent::CheckBox).new
@action = node.fetch("action", "")
@method = node.fetch("method", "GET").upcase
#@name = node['name']
#@clicked_buttons = []
#@page = page
#@mech = mech
#
#@encoding = node['accept-charset'] || (page && page.encoding) || nil
#@ignore_encoding_error = false
parse