Class: Odca::HeadfulOverlay
- Inherits:
-
Object
- Object
- Odca::HeadfulOverlay
- Extended by:
- Forwardable
- Defined in:
- lib/odca/headful_overlay.rb
Constant Summary collapse
- OVERLAYS_INFO =
'config/overlays_info.yml'.freeze
Instance Attribute Summary collapse
-
#parentful_overlay ⇒ Object
readonly
Returns the value of attribute parentful_overlay.
-
#purpose ⇒ Object
readonly
Returns the value of attribute purpose.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Instance Method Summary collapse
- #header ⇒ Object
-
#initialize(parentful_overlay:, role:, purpose:) ⇒ HeadfulOverlay
constructor
A new instance of HeadfulOverlay.
- #overlay_info ⇒ Object
- #overlays_info ⇒ Object
- #to_h ⇒ Object
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(parentful_overlay:, role:, purpose:) ⇒ HeadfulOverlay
Returns a new instance of HeadfulOverlay.
14 15 16 17 18 19 |
# File 'lib/odca/headful_overlay.rb', line 14 def initialize(parentful_overlay:, role:, purpose:) @parentful_overlay = @role = role @purpose = purpose @overlays_info = end |
Instance Attribute Details
#parentful_overlay ⇒ Object (readonly)
Returns the value of attribute parentful_overlay.
8 9 10 |
# File 'lib/odca/headful_overlay.rb', line 8 def @parentful_overlay end |
#purpose ⇒ Object (readonly)
Returns the value of attribute purpose.
8 9 10 |
# File 'lib/odca/headful_overlay.rb', line 8 def purpose @purpose end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
8 9 10 |
# File 'lib/odca/headful_overlay.rb', line 8 def role @role end |
Instance Method Details
#header ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/odca/headful_overlay.rb', line 30 def header @header ||= Odca::Overlays::Header.new( role: role, purpose: purpose, type: ['type_v1'] ) end |
#overlay_info ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/odca/headful_overlay.rb', line 45 def = .class.name.split('::').last = .gsub('Overlay', '').gsub(/([^\^])([A-Z])/,'\1_\2').downcase .fetch() do raise "Not found specific information about #{}" end end |
#overlays_info ⇒ Object
39 40 41 42 43 |
# File 'lib/odca/headful_overlay.rb', line 39 def @overlays_info ||= YAML.safe_load( File.open(File.join(Odca::ROOT_PATH, OVERLAYS_INFO)) ) end |
#to_h ⇒ Object
25 26 27 28 |
# File 'lib/odca/headful_overlay.rb', line 25 def to_h header.to_h .merge(.to_h) end |
#to_json(options = {}) ⇒ Object
21 22 23 |
# File 'lib/odca/headful_overlay.rb', line 21 def to_json( = {}) to_h.to_json(*) end |