class FlipTheSwitch::Generator::Plist

Public Instance Methods

generate() click to toggle source
# File lib/flip_the_switch/generator/plist.rb, line 7
def generate
  ::Plist::Emit.save_plist(feature_states, output_file)
end

Private Instance Methods

feature_hash(feature) click to toggle source
# File lib/flip_the_switch/generator/plist.rb, line 19
def feature_hash(feature)
  if feature.description
    {enabled: feature.enabled, description: feature.description}
  else
    {enabled: feature.enabled}
  end
end
feature_states() click to toggle source
# File lib/flip_the_switch/generator/plist.rb, line 13
def feature_states
  all_features.inject({}) do |states, feature|
    states.merge(feature.name => feature_hash(feature))
  end
end
output_file() click to toggle source
# File lib/flip_the_switch/generator/plist.rb, line 27
def output_file
  if File.directory?(output)
    File.join(output, 'Features.plist')
  else
    output
  end
end