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