Class: BxBuilderChain::Data
- Inherits:
-
Object
- Object
- BxBuilderChain::Data
- Defined in:
- lib/bx_builder_chain/data.rb
Overview
Abstraction for data loaded by a Loader
Instance Attribute Summary collapse
-
#source ⇒ String
readonly
URL or Path of the data source.
Instance Method Summary collapse
- #chunks(opts = {}) ⇒ Array<String>
-
#initialize(data, options = {}) ⇒ Data
constructor
A new instance of Data.
- #value ⇒ String
Constructor Details
#initialize(data, options = {}) ⇒ Data
Returns a new instance of Data.
12 13 14 15 |
# File 'lib/bx_builder_chain/data.rb', line 12 def initialize(data, = {}) @source = [:source] @data = data end |
Instance Attribute Details
#source ⇒ String (readonly)
URL or Path of the data source
8 9 10 |
# File 'lib/bx_builder_chain/data.rb', line 8 def source @source end |
Instance Method Details
#chunks(opts = {}) ⇒ Array<String>
24 25 26 |
# File 'lib/bx_builder_chain/data.rb', line 24 def chunks(opts = {}) BxBuilderChain::Chunker::RecursiveText.new(@data, **opts).chunks end |
#value ⇒ String
18 19 20 |
# File 'lib/bx_builder_chain/data.rb', line 18 def value @data end |