Class: CommandStep
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- CommandStep
- Defined in:
- lib/schema.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 |
# File 'lib/schema.rb', line 1655 def self.from_dynamic!(d) d = Types::Hash[d] new( agents: d["agents"] ? Agents.from_dynamic!(d["agents"]) : nil, allow_dependency_failure: d["allow_dependency_failure"] ? AllowDependencyFailureUnion.from_dynamic!(d["allow_dependency_failure"]) : nil, artifact_paths: d["artifact_paths"] ? Branches.from_dynamic!(d["artifact_paths"]) : nil, branches: d["branches"] ? Branches.from_dynamic!(d["branches"]) : nil, cache: d["cache"] ? Cache.from_dynamic!(d["cache"]) : nil, cancel_on_build_failing: d["cancel_on_build_failing"] ? AllowDependencyFailureUnion.from_dynamic!(d["cancel_on_build_failing"]) : nil, command: d["command"] ? Branches.from_dynamic!(d["command"]) : nil, commands: d["commands"] ? Branches.from_dynamic!(d["commands"]) : nil, concurrency: d["concurrency"], concurrency_group: d["concurrency_group"], concurrency_method: d["concurrency_method"], depends_on: d["depends_on"] ? DependsOn.from_dynamic!(d["depends_on"]) : nil, env: Types::Hash.optional[d["env"]]&.transform_values { |v| Types::Any[v] }, id: d["id"], identifier: d["identifier"], command_step_if: d["if"], key: d["key"], label: d["label"], matrix: d["matrix"] ? MatrixUnion.from_dynamic!(d["matrix"]) : nil, command_step_name: d["name"], notify: d["notify"]&.map { |x| NotifyElement.from_dynamic!(x) }, parallelism: d["parallelism"], plugins: d["plugins"] ? Plugins.from_dynamic!(d["plugins"]) : nil, priority: d["priority"], command_step_retry: d["retry"] ? Retry.from_dynamic!(d["retry"]) : nil, signature: d["signature"] ? Signature.from_dynamic!(d["signature"]) : nil, skip: d["skip"] ? Skip.from_dynamic!(d["skip"]) : nil, soft_fail: d["soft_fail"] ? SoftFail.from_dynamic!(d["soft_fail"]) : nil, timeout_in_minutes: d["timeout_in_minutes"], command_step_type: d["type"] ) end |
.from_json!(json) ⇒ Object
1691 1692 1693 |
# File 'lib/schema.rb', line 1691 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 |
# File 'lib/schema.rb', line 1695 def to_dynamic { "agents" => agents&.to_dynamic, "allow_dependency_failure" => allow_dependency_failure&.to_dynamic, "artifact_paths" => artifact_paths&.to_dynamic, "branches" => branches&.to_dynamic, "cache" => cache&.to_dynamic, "cancel_on_build_failing" => cancel_on_build_failing&.to_dynamic, "command" => command&.to_dynamic, "commands" => commands&.to_dynamic, "concurrency" => concurrency, "concurrency_group" => concurrency_group, "concurrency_method" => concurrency_method, "depends_on" => depends_on&.to_dynamic, "env" => env, "id" => id, "identifier" => identifier, "if" => command_step_if, "key" => key, "label" => label, "matrix" => matrix&.to_dynamic, "name" => command_step_name, "notify" => notify&.map(&:to_dynamic), "parallelism" => parallelism, "plugins" => plugins&.to_dynamic, "priority" => priority, "retry" => command_step_retry&.to_dynamic, "signature" => signature&.to_dynamic, "skip" => skip&.to_dynamic, "soft_fail" => soft_fail&.to_dynamic, "timeout_in_minutes" => timeout_in_minutes, "type" => command_step_type } end |
#to_json(options = nil) ⇒ Object
1730 1731 1732 |
# File 'lib/schema.rb', line 1730 def to_json( = nil) JSON.generate(to_dynamic, ) end |