Sha256: a022045e14038e4d5e39e9c208c0d0c01f4b029ce9436db519d4669b7b331e0a

Contents?: true

Size: 772 Bytes

Versions: 11

Compression:

Stored size: 772 Bytes

Contents

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

  attr_accessor :flairs

  def setup
    self.flairs = []
  end

  def add(klass)
    flairs << klass.class.to_sym
  end

  def execute
    do! :flair_page
  end

  def flair_for(drone_name)
    drone = send(drone_name)
    return drone.render 'flair.html.slim', skip_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

11 entries across 6 versions & 1 rubygems

Version Path
app_drone-0.6.1 lib/app_drone/drones/flair/flair.rb~
app_drone-0.6.0 lib/app_drone/drones/flair/flair.rb~
app_drone-0.6.0 lib/app_drone/drones/flair/flair.rb
app_drone-0.5.2 lib/app_drone/drones/flair/flair.rb~
app_drone-0.5.2 lib/app_drone/drones/flair/flair.rb
app_drone-0.5.1 lib/app_drone/drones/flair/flair.rb~
app_drone-0.5.1 lib/app_drone/drones/flair/flair.rb
app_drone-0.5.0 lib/app_drone/drones/flair/flair.rb~
app_drone-0.5.0 lib/app_drone/drones/flair/flair.rb
app_drone-0.4.0 lib/app_drone/drones/flair/flair.rb
app_drone-0.4.0 lib/app_drone/drones/flair/flair.rb~