Class: Travis::Yaml::Nodes::Notifications::Notification

Inherits:
Mapping show all
Defined in:
lib/travis/yaml/nodes/notifications.rb

Direct Known Subclasses

Flowdock, WithTemplate

Instance Attribute Summary

Attributes inherited from Mapping

#mapping

Attributes inherited from Travis::Yaml::Nodes::Node

#parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Mapping

#==, #[], #[]=, #accept_key?, aliases, auto_prefix, #deep_verify, define_map_accessor, drop_empty, #drop_empty?, #each_scalar, #empty?, experimental, #include?, #inspect, map, #mapped_key, mapping, #nested_warnings, prefix_scalar, prefix_sequence, #prepare, required, #subnode_for, subnode_for, #verify, #verify_empty, #verify_errors, #verify_experimental, #verify_required, #visit_key_value, #visit_mapping, #visit_pair, #with_value!

Methods inherited from Travis::Yaml::Nodes::Node

#decrypt, #decrypted?, #deep_verify, #dup, #encrypt, #encrypted?, #error, #errors, #errors?, has_default?, #initialize, #method_missing, #nested_warning, #nested_warnings, #prepare, #respond_to_missing?, #serialize, #to_json, #to_legacy_ruby, #to_ruby, #to_s, #to_yaml, #verify, #verify_language, #visit_child, #visit_mapping, #visit_pair, #visit_sequence, #visit_unexpected, #warngings?, #warning, #warnings, #with_value

Constructor Details

This class inherits a constructor from Travis::Yaml::Nodes::Node

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Travis::Yaml::Nodes::Node

Class Method Details

.[](name) ⇒ Object



14
15
16
# File 'lib/travis/yaml/nodes/notifications.rb', line 14

def self.[](name)
  Class.new(self) { list(name) }
end

.list(name) ⇒ Object



18
19
20
21
22
# File 'lib/travis/yaml/nodes/notifications.rb', line 18

def self.list(name)
  map name, to: List
  prefix_sequence name
  prefix_scalar name, :str, :secure
end

Instance Method Details

#disabled?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/travis/yaml/nodes/notifications.rb', line 33

def disabled?
  !enabled?
end

#enabled?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/travis/yaml/nodes/notifications.rb', line 29

def enabled?
  @mapping.fetch('enabled', !@mapping['disabled'])
end

#visit_scalar(visitor, type, value, implicit = true) ⇒ Object



24
25
26
27
# File 'lib/travis/yaml/nodes/notifications.rb', line 24

def visit_scalar(visitor, type, value, implicit = true)
  return super unless type == :bool
  visit_key_value(visitor, :enabled, value)
end