Module: Brutal::Yaml

Defined in:
lib/brutal/yaml.rb

Overview

Brutal::Yaml

Since:

  • 1.1.0

Constant Summary collapse

FILENAME_EXTENSIONS =

Since:

  • 1.1.0

%w[
  .yaml
  .yml
].freeze

Class Method Summary collapse

Class Method Details

.parse(yaml) ⇒ Object

Since:

  • 1.1.0



15
16
17
# File 'lib/brutal/yaml.rb', line 15

def self.parse(yaml)
  ::YAML.safe_load(yaml, symbolize_names: false)
end

.parse?(pathname) ⇒ Boolean

Returns:

  • (Boolean)

Since:

  • 1.1.0



19
20
21
22
# File 'lib/brutal/yaml.rb', line 19

def self.parse?(pathname)
  filename_extension = pathname.extname
  FILENAME_EXTENSIONS.include?(filename_extension)
end