Class: RussianHill

Inherits:
Object
  • Object
show all
Includes:
CableReady::Broadcaster
Defined in:
lib/russian_hill.rb,
lib/russian_hill/railtie.rb,
lib/russian_hill/version.rb,
lib/russian_hill/dependency_tracker.rb

Defined Under Namespace

Modules: DependencyTrackerMethods Classes: Railtie

Constant Summary collapse

VERSION =
'0.1.0'
DependencyTracker =
Class.new(dependency_tracker::ERBTracker)

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) {|_self| ... } ⇒ RussianHill

Returns a new instance of RussianHill.

Yields:

  • (_self)

Yield Parameters:

  • _self (RussianHill)

    the object that the method was called on



6
7
8
9
10
# File 'lib/russian_hill.rb', line 6

def initialize(context)
  @context = context
  @operations = cable_car
  yield self if ::Kernel.block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



21
22
23
# File 'lib/russian_hill.rb', line 21

def method_missing symbol, *args
  @operations = @operations.public_send(symbol, *args)
end

Class Method Details

.encode(*args, &block) ⇒ Object

Yields a builder and automatically turns the result into a JSON string



13
14
15
# File 'lib/russian_hill.rb', line 13

def self.encode(*args, &block)
  new(*args, &block).target!
end

Instance Method Details

#target!Object



17
18
19
# File 'lib/russian_hill.rb', line 17

def target!
  @operations.dispatch.to_json
end