Class: Chaindrive::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/chaindrive/index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeIndex

Returns a new instance of Index.



6
7
8
9
# File 'lib/chaindrive/index.rb', line 6

def initialize
  @sources = []
  @groups = []
end

Instance Attribute Details

#gearsObject (readonly)

Returns the value of attribute gears.



4
5
6
# File 'lib/chaindrive/index.rb', line 4

def gears
  @gears
end

#groupsObject (readonly)

Returns the value of attribute groups.



4
5
6
# File 'lib/chaindrive/index.rb', line 4

def groups
  @groups
end

#sourcesObject (readonly)

Returns the value of attribute sources.



4
5
6
# File 'lib/chaindrive/index.rb', line 4

def sources
  @sources
end

Instance Method Details

#gear(name, *args) ⇒ Object



30
31
32
# File 'lib/chaindrive/index.rb', line 30

def gear(name, *args)
  spec = { name: name.to_s }
end

#gearbox(name, *args, &block) ⇒ Object



34
35
36
# File 'lib/chaindrive/index.rb', line 34

def gearbox(name, *args, &block)

end

#group(*args, &block) ⇒ Object



23
24
25
26
27
28
# File 'lib/chaindrive/index.rb', line 23

def group(*args, &block)
  @groups.concat args
  yield
ensure
  args.each { @groups.pop }
end

#source(source, opts = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/chaindrive/index.rb', line 11

def source(source, opts = {})
  source = 'http://chaindrive.io' if source == :chaindrive
  if opts[:prepend]
    @sources = [ source ] | @sources
  else
    @sources << source
  end

  yield if block_given?
  source
end