Class: WhatToDo::FacetAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/whatToDo/facet_analyzer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFacetAnalyzer

Returns a new instance of FacetAnalyzer.



5
6
7
8
9
10
11
12
13
# File 'lib/whatToDo/facet_analyzer.rb', line 5

def initialize
  @facets = []

  # Require all facet scripts
  dir = Pathname.new(File.dirname(__FILE__) + '/facet').cleanpath
  Dir["#{dir}/*.rb"].each do |file|
    instance_eval(File.open(File.expand_path(file)).read)
  end
end

Instance Attribute Details

#facetsObject (readonly)

Returns the value of attribute facets.



3
4
5
# File 'lib/whatToDo/facet_analyzer.rb', line 3

def facets
  @facets
end

Instance Method Details

#facet(facets) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/whatToDo/facet_analyzer.rb', line 15

def facet(facets)
  unless facets.is_a?(Array)
    facets = [facets]
  end

  @facets += facets if yield
  @facets.flatten
end