Class: Chaindrive::Index
- Inherits:
-
Object
- Object
- Chaindrive::Index
- Defined in:
- lib/chaindrive/index.rb
Instance Attribute Summary collapse
-
#gears ⇒ Object
readonly
Returns the value of attribute gears.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Instance Method Summary collapse
- #gear(name, *args) ⇒ Object
- #gearbox(name, *args, &block) ⇒ Object
- #group(*args, &block) ⇒ Object
-
#initialize ⇒ Index
constructor
A new instance of Index.
- #source(source, opts = {}) ⇒ Object
Constructor Details
#initialize ⇒ Index
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
#gears ⇒ Object (readonly)
Returns the value of attribute gears.
4 5 6 |
# File 'lib/chaindrive/index.rb', line 4 def gears @gears end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
4 5 6 |
# File 'lib/chaindrive/index.rb', line 4 def groups @groups end |
#sources ⇒ Object (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 |