Class: CC::Yaml::Nodes::Fetch
- Defined in:
- lib/cc/yaml/nodes/fetch.rb
Constant Summary collapse
- INVALID_URL_ERROR =
"invalid URL: %s".freeze
- EMPTY_PATH_ERROR =
"path cannot be empty".freeze
- ABSOLUTE_PATH_ERROR =
"absolute path \"%s\" is invalid".freeze
- PARENT_PATH_ERROR =
"relative path elements in \"%s\" are invalid: use \"%s\" instead".freeze
Constants inherited from Mapping
Mapping::INCOMPATIBLE_KEYS_WARNING
Instance Attribute Summary
Attributes inherited from Mapping
Attributes inherited from Node
Instance Method Summary collapse
Methods inherited from Mapping
#==, #[], #[]=, #accept_key?, aliases, #deep_verify, define_map_accessor, #each_scalar, #empty?, #include?, #inspect, map, #mapped_key, mapping, #nested_warnings, prefix_scalar, #prepare, required, #set_warnings, #subnode_for, subnode_for_key, #verify_errors, #verify_required, #visit_key_value, #visit_mapping, #visit_pair, #with_value!
Methods inherited from Node
#as_json, #deep_verify, #dup, #error, #errors, #errors?, has_default?, #initialize, #method_missing, #nested_warning, #nested_warnings, #prepare, #respond_to_missing?, #to_s, #visit_child, #visit_mapping, #visit_pair, #visit_sequence, #visit_unexpected, #warning, #warnings, #warnings?, #with_value
Constructor Details
This class inherits a constructor from CC::Yaml::Nodes::Node
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CC::Yaml::Nodes::Node
Instance Method Details
#verify ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/cc/yaml/nodes/fetch.rb', line 28 def verify if !url.nil? && path.nil? self.path = path_node_from_url(url.value) end error(format(INVALID_URL_ERROR, url.value)) if url && !valid_url?(url.value) validate_path(path.value) if path super end |
#visit_scalar(_visitor, type, value_node, _implicit = true) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cc/yaml/nodes/fetch.rb', line 16 def visit_scalar(_visitor, type, value_node, _implicit = true) if type == :str if valid_url?(value_node.value) self.url = url_node_from_url(value_node.value) else error(format(INVALID_URL_ERROR, value_node.value)) end else super end end |