class FakeFlorence::Feature

Public Class Methods

new(keys = {}) click to toggle source
Calls superclass method
# File lib/fake_florence/feature.rb, line 13
def initialize(keys = {})
  super(FeatureSchema.call(keys).to_h)
end
read(id, pathname) click to toggle source
# File lib/fake_florence/feature.rb, line 7
def self.read(id, pathname)
  new(YAML.load_file(pathname)).tap do |feature|
    feature[:id] = id
  end
end

Public Instance Methods

saveable() click to toggle source
# File lib/fake_florence/feature.rb, line 24
def saveable
  to_h.tap do |h|
    h.delete('id')
  end.to_yaml
end
to_h() click to toggle source
# File lib/fake_florence/feature.rb, line 17
def to_h
  each_pair.reduce({}) do |h, (k, v)|
    h[k.to_s] = v
    h
  end
end