diff --git a/src/mechanize/file.cr b/src/mechanize/file.cr index 02539b4..900d239 100644 --- a/src/mechanize/file.cr +++ b/src/mechanize/file.cr @@ -1,9 +1,15 @@ require "http/client" class Mechanize - class File - # property :body, :filename - property :body, :code, uri, :response + abstract class File + # property :filename + + # returns http response body + getter body : String + # returns http status code + getter code : Int32 + # returns page uri + getter uri : URI def initialize(uri : URI, response : ::HTTP::Client::Response, body : String, code : Int32) @uri = uri diff --git a/src/mechanize/form.cr b/src/mechanize/form.cr index a993e3d..a868ec1 100644 --- a/src/mechanize/form.cr +++ b/src/mechanize/form.cr @@ -13,7 +13,7 @@ class Mechanize::Form include Mechanize::ElementMatcher getter node : Node | Lexbor::Node - # returns an array of `Mechanize::FormContent::Field` in the form. + # returns hoge array of `Mechanize::FormContent::Field` in the form. getter fields : Array(FormContent::Field) # returns an array of input tags whose type is checkbox in the form. getter checkboxes : Array(FormContent::CheckBox) @@ -23,11 +23,16 @@ class Mechanize::Form getter selectboxes : Array(FormContent::MultiSelectList) # returns an array of button tags and input tag whose type is button,submit,reset,image. getter buttons : Array(FormContent::Button) + # returns form's 'enctype' attribute. getter enctype : String + # returns form's 'method' attribute. getter method : String + # returns form's 'name' attribute. getter name : String - getter page : Mechanize::Page? + # return form's 'action' attribute. property action : String + # returns the page which includes the form. + getter page : Mechanize::Page? def initialize(node : Node | Lexbor::Node, page : Mechanize::Page? = nil) @enctype = node.fetch("enctype", "application/x-www-form-urlencoded") diff --git a/src/mechanize/utils/element_matcher.cr b/src/mechanize/utils/element_matcher.cr index f36d262..4acd692 100644 --- a/src/mechanize/utils/element_matcher.cr +++ b/src/mechanize/utils/element_matcher.cr @@ -6,7 +6,7 @@ class Mechanize # # Examples # ``` - # # if you specify String like "foo", it searches form which name is "foo". + # # if you specify String like "foo", it searches {{ singular.id }} which name is "foo". {% if ["form", "button"].includes?("#{singular.id}") %} # # like <{{ singular.id }} name="foo"> {% elsif "#{singular.id}" == "field" %}