Sha256: 796fb47443bf357e2081b0e2e24fa57fd56cea5c991fe370298b50f362ec8059

Contents?: true

Size: 787 Bytes

Versions: 4

Compression:

Stored size: 787 Bytes

Contents

module AppDrone
class Flair < Drone
  desc "Creates a page to demonstrate the drones' hard work"
  depends_on :high_voltage, :slim_view

  attr_accessor :flairs

  def setup
    self.flairs = []
  end

  def add(klass)
    flairs << klass.class.to_s.gsub('AppDrone::','').underscore.to_sym
  end

  def execute
    do! :flair_page
  end

  def flair_for(drone_name)
    drone = send(drone_name)
    return drone.render 'flair.html.slim', stamp: true
  end
end


# extend drones so they can call `flair!` rather than the verbose method
# this pattern is useful for drones that take a single boolean parameter
# e.g. 
#   flair: do / don't flair, as opposed to
#   bootstrap: vendor, responsive, font_awesome...
class Drone
  def flair!
    flair.add(self) if pair?(:flair)
  end
end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
app_drone-0.3.4 lib/app_drone/drones/flair/flair.rb~
app_drone-0.3.3 lib/app_drone/drones/flair/flair.rb~
app_drone-0.3.2 lib/app_drone/drones/flair/flair.rb~
app_drone-0.3.1 lib/app_drone/drones/flair/flair.rb~