class MU::Config::Tail
A wrapper for config leaves that came from ERB parameters instead of raw YAML or JSON. Will behave like a string for things that expect that sort of thing. Code that needs to know that this leaf was the result of a parameter will be able to tell by the object class being something other than a plain string, array, or hash.
Attributes
Public Class Methods
# File modules/mu/config/tail.rb, line 45 def initialize(name, value, prettyname = nil, cloudtype = "String", valid_values = [], description = "", is_list_element = false, prefix: "", suffix: "", pseudo: false, runtimecode: nil, index: 0) @name = name @bindings = {} @value = value @valid_values = valid_values @pseudo = pseudo @index = index @runtimecode = runtimecode @cloudtype = cloudtype @is_list_element = is_list_element @description ||= if !description.nil? description else "" end @prettyname ||= if !prettyname.nil? prettyname else @name.capitalize.gsub(/[^a-z0-9]/i, "") end @prefix = prefix if !prefix.nil? @suffix = suffix if !suffix.nil? end
Public Instance Methods
Concatenate like a string
# File modules/mu/config/tail.rb, line 112 def +(o) return to_s if o.nil? to_s + o.to_s end
Check for equality like a String
# File modules/mu/config/tail.rb, line 108 def ==(o) (o.class == self.class or o.class == "String") && o.to_s == to_s end
Lets callers access us like a {Hash} @param attribute [String,Symbol]
# File modules/mu/config/tail.rb, line 123 def [](attribute) if respond_to?(attribute.to_sym) send(attribute.to_sym) else nil end end
Downcase like a String
# File modules/mu/config/tail.rb, line 96 def downcase to_s.downcase end
Check for emptiness like a String
# File modules/mu/config/tail.rb, line 100 def empty? to_s.empty? end
Return the platform-specific cloud type of this Tail
# File modules/mu/config/tail.rb, line 76 def getCloudType @cloudtype end
Return the parameter name of this Tail
# File modules/mu/config/tail.rb, line 72 def getName @name end
Return the human-friendly name of this Tail
# File modules/mu/config/tail.rb, line 80 def getPrettyName @prettyname end
Perform global substitutions like a String
# File modules/mu/config/tail.rb, line 117 def gsub(*args) to_s.gsub(*args) end
Match like a String
# File modules/mu/config/tail.rb, line 104 def match(*args) to_s.match(*args) end
Walk like a String
# File modules/mu/config/tail.rb, line 84 def to_s @prefix.to_s+@value.to_s+@suffix.to_s end
Quack like a String
# File modules/mu/config/tail.rb, line 88 def to_str to_s end
Upcase like a String
# File modules/mu/config/tail.rb, line 92 def upcase to_s.upcase end