Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/glyph/node.rb,
lib/glyph/system_extensions.rb
Overview
Core Hash class.
Direct Known Subclasses
Instance Method Summary collapse
-
#to_node ⇒ Node
Converts self to a Node.
-
#to_options(sep = " ") ⇒ Object
Converts the hash to a string of Glyph options.
Instance Method Details
#to_node ⇒ Node
Converts self to a Node
8 9 10 |
# File 'lib/glyph/node.rb', line 8 def to_node Node.new.replace self end |
#to_options(sep = " ") ⇒ Object
Converts the hash to a string of Glyph options.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/glyph/system_extensions.rb', line 20 def (sep=" ") "".tap do |s| self.each_pair do |k, v| key = k.to_s s += key.length == 1 ? "-" : "--" s += key s += sep s += v.to_s =~ /\s/ ? "\"#{v}\"" : v.to_s s += " " end end.strip end |