Class: Regexp

Inherits:
Object show all
Defined in:
lib/core_ex/yaml.rb

Constant Summary collapse

@@options =
{
  'm' => MULTILINE,
  'i' => IGNORECASE,
  'x' => EXTENDED
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.yaml_load(val) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
# File 'lib/core_ex/yaml.rb', line 105

def self.yaml_load ( val )
  if val.is_a? Array and val.size == 2
    options = 0
    val.last.split(//).each do |opt|
      options |= @@options[opt]
    end
    new(val.first, options)
  else
    new(val.to_s)
  end
end

Instance Method Details

#to_yaml_stringObject



94
95
96
# File 'lib/core_ex/yaml.rb', line 94

def to_yaml_string
  source
end