refactor code
parent
0df9f07aef
commit
c2411e73eb
|
@ -2,10 +2,10 @@ class MechanizeCr::FormContent::CheckBox < MechanizeCr::FormContent::Field
|
|||
property :checked
|
||||
property :form
|
||||
|
||||
def initialize(node : Node | Myhtml::Node, value : String = node.fetch("value", ""))
|
||||
def initialize(node : Node | Myhtml::Node, value = "")
|
||||
@checked = !!node["checked"]
|
||||
@form = form
|
||||
super(node)
|
||||
super(node, value)
|
||||
end
|
||||
|
||||
def check
|
||||
|
|
|
@ -6,8 +6,8 @@ module MechanizeCr
|
|||
class Agent
|
||||
property :request_headers, :context, :cookies
|
||||
property history : Array(MechanizeCr::Page)
|
||||
def initialize(@context : Mechanize | Nil = nil, history = Array(MechanizeCr::Page).new)
|
||||
@history = history
|
||||
def initialize(@context : Mechanize | Nil = nil)
|
||||
@history = Array(MechanizeCr::Page).new
|
||||
@request_headers = ::HTTP::Headers.new
|
||||
@context = context
|
||||
@cookies = Hash(String, ::HTTP::Cookies).new
|
||||
|
|
|
@ -6,7 +6,6 @@ class Node < Hash(String,String)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
# This is a real Node got from html.
|
||||
struct Myhtml::Node
|
||||
delegate :[], to: attributes
|
||||
|
|
Loading…
Reference in New Issue