Class: ShopifyCLI::Theme::DevServer::LocalAssets::FileBody

Inherits:
Object
  • Object
show all
Defined in:
lib/shopify_cli/theme/dev_server/local_assets.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FileBody

Returns a new instance of FileBody.



10
11
12
# File 'lib/shopify_cli/theme/dev_server/local_assets.rb', line 10

def initialize(path)
  @path = path
end

Instance Method Details

#each {|@path.read| ... } ⇒ Object

Naive implementation. Only used in unit tests.

Yields:

  • (@path.read)


15
16
17
# File 'lib/shopify_cli/theme/dev_server/local_assets.rb', line 15

def each
  yield @path.read
end

#to_pathObject

Rack will stream a body that responds to ‘to_path`



20
21
22
# File 'lib/shopify_cli/theme/dev_server/local_assets.rb', line 20

def to_path
  @path.to_path
end