Class: SolrMakr::Configsets::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/solr_makr/configsets/node.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentString (readonly)

Returns:

  • (String)


19
20
21
# File 'lib/solr_makr/configsets/node.rb', line 19

attr_lazy_reader :content do
  path.read
end

Class Method Details

.gather(root:) ⇒ <SolrMakr::Configsets::Node>

Parameters:

  • root (Pathname)

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/solr_makr/configsets/node.rb', line 38

def gather(root:)
  [].tap do |nodes|
    root.find do |path|
      unless path.directory?
        nodes << SolrMakr::Configsets::Node.new(root: root, path: path)
      else
        if path.basename.to_s[0] == '.'
          Find.prune
        else
          next
        end
      end
    end
  end
end

Instance Method Details

#full_name(prefix: '') ⇒ String

Returns:

  • (String)


13
14
15
# File 'lib/solr_makr/configsets/node.rb', line 13

def full_name(prefix: '')
  File.join(prefix, name)
end

#readable?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/solr_makr/configsets/node.rb', line 23

def readable?
  content rescue false
end