Class: Pione::LiterateAction::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/pione/literate-action/document.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(src) ⇒ Document

Returns a new instance of Document.



9
10
11
# File 'lib/pione/literate-action/document.rb', line 9

def initialize(src)
  @action = MarkdownParser.parse(src)
end

Class Method Details

.load(location) ⇒ Object

Load a literate document from the location.



5
6
7
# File 'lib/pione/literate-action/document.rb', line 5

def self.load(location)
  new(location.read)
end

Instance Method Details

#action_namesArray<String>

Return action rule names in the document.

Returns:

  • (Array<String>)

    rule names



17
18
19
# File 'lib/pione/literate-action/document.rb', line 17

def action_names
  @action.keys
end

#find(name) ⇒ Object

Find target action by the name.



22
23
24
25
26
# File 'lib/pione/literate-action/document.rb', line 22

def find(name)
  if action = @action[name]
    Handler.new(action)
  end
end